From e855143dea6e744d6d2c04ff9c55031971c46670 Mon Sep 17 00:00:00 2001
From: Colin Stewart <79332690+costdev@users.noreply.github.com>
Date: Wed, 13 Nov 2024 16:52:01 +0000
Subject: [PATCH] Move test files into `tests/phpunit/`. (#182)
---
.github/workflows/phpunit-tests.yml | 2 +-
.gitignore | 4 ++--
composer.json | 2 +-
phpunit.xml.dist | 8 ++++----
tests/{ => phpunit}/bootstrap.php | 2 +-
tests/{ => phpunit}/multisite.xml | 7 +++----
.../tests}/AdminSettings/AdminSettings_GetSettingTest.php | 0
.../tests}/Branding/Branding_AdminEnqueueScriptsTest.php | 0
.../tests}/Branding/Branding_ConstructTest.php | 0
.../tests}/Branding/Branding_GetInstanceTest.php | 0
.../tests}/Branding/Branding_OutputAdminNoticeTest.php | 0
11 files changed, 12 insertions(+), 13 deletions(-)
rename tests/{ => phpunit}/bootstrap.php (95%)
rename tests/{ => phpunit}/multisite.xml (84%)
rename tests/{ => phpunit/tests}/AdminSettings/AdminSettings_GetSettingTest.php (100%)
rename tests/{ => phpunit/tests}/Branding/Branding_AdminEnqueueScriptsTest.php (100%)
rename tests/{ => phpunit/tests}/Branding/Branding_ConstructTest.php (100%)
rename tests/{ => phpunit/tests}/Branding/Branding_GetInstanceTest.php (100%)
rename tests/{ => phpunit/tests}/Branding/Branding_OutputAdminNoticeTest.php (100%)
diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml
index 5df4efc..9aabbb7 100644
--- a/.github/workflows/phpunit-tests.yml
+++ b/.github/workflows/phpunit-tests.yml
@@ -39,4 +39,4 @@ jobs:
run: bash bin/install-wp-tests.sh wordpress_tests root root 127.0.0.1 latest true
- name: Run tests
- run: XDEBUG_MODE=off phpunit${{ matrix.multisite && ' -c tests/multisite.xml' || '' }}
+ run: XDEBUG_MODE=off phpunit${{ matrix.multisite && ' -c tests/phpunit/multisite.xml' || '' }}
diff --git a/.gitignore b/.gitignore
index beb2775..814b1e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,8 @@
/phpunit.xml
/vendor
.cache/*
-/tests/cache
-/tests/coverage
+/tests/phpunit/cache
+/tests/phpunit/coverage
.DS_Store
# Track placeholders so that empty directories stay in the repo.
diff --git a/composer.json b/composer.json
index 40c90f8..f460e06 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,7 @@
"format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --report=summary,source",
"lint": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --report=summary, source",
"test": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit" ],
- "test:multisite": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit -c tests/multisite.xml" ]
+ "test:multisite": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit -c tests/phpunit/multisite.xml" ]
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 72d0b05..f4695c2 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,7 +1,7 @@
- ./tests/
+ ./tests/phpunit/tests/
@@ -19,7 +19,7 @@
ms-required
-
+
./aspire-update.php
./includes
@@ -29,7 +29,7 @@
-
+
diff --git a/tests/bootstrap.php b/tests/phpunit/bootstrap.php
similarity index 95%
rename from tests/bootstrap.php
rename to tests/phpunit/bootstrap.php
index c44d4d8..2a947de 100644
--- a/tests/bootstrap.php
+++ b/tests/phpunit/bootstrap.php
@@ -32,7 +32,7 @@
*/
function _manually_load_plugin() {
- require dirname( __DIR__ ) . '/aspire-update.php';
+ require dirname( __DIR__ ) . '/../aspire-update.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
diff --git a/tests/multisite.xml b/tests/phpunit/multisite.xml
similarity index 84%
rename from tests/multisite.xml
rename to tests/phpunit/multisite.xml
index 1536460..c081e2d 100644
--- a/tests/multisite.xml
+++ b/tests/phpunit/multisite.xml
@@ -13,12 +13,11 @@
>
-
- ./
+ ./tests
@@ -28,10 +27,10 @@
- ../includes
+ ../../includes
- ../includes/autoload.php
+ ../../includes/autoload.php
diff --git a/tests/AdminSettings/AdminSettings_GetSettingTest.php b/tests/phpunit/tests/AdminSettings/AdminSettings_GetSettingTest.php
similarity index 100%
rename from tests/AdminSettings/AdminSettings_GetSettingTest.php
rename to tests/phpunit/tests/AdminSettings/AdminSettings_GetSettingTest.php
diff --git a/tests/Branding/Branding_AdminEnqueueScriptsTest.php b/tests/phpunit/tests/Branding/Branding_AdminEnqueueScriptsTest.php
similarity index 100%
rename from tests/Branding/Branding_AdminEnqueueScriptsTest.php
rename to tests/phpunit/tests/Branding/Branding_AdminEnqueueScriptsTest.php
diff --git a/tests/Branding/Branding_ConstructTest.php b/tests/phpunit/tests/Branding/Branding_ConstructTest.php
similarity index 100%
rename from tests/Branding/Branding_ConstructTest.php
rename to tests/phpunit/tests/Branding/Branding_ConstructTest.php
diff --git a/tests/Branding/Branding_GetInstanceTest.php b/tests/phpunit/tests/Branding/Branding_GetInstanceTest.php
similarity index 100%
rename from tests/Branding/Branding_GetInstanceTest.php
rename to tests/phpunit/tests/Branding/Branding_GetInstanceTest.php
diff --git a/tests/Branding/Branding_OutputAdminNoticeTest.php b/tests/phpunit/tests/Branding/Branding_OutputAdminNoticeTest.php
similarity index 100%
rename from tests/Branding/Branding_OutputAdminNoticeTest.php
rename to tests/phpunit/tests/Branding/Branding_OutputAdminNoticeTest.php