From 72d76d9da24cb4de85c81356a377ae414f5ddb45 Mon Sep 17 00:00:00 2001 From: costdev Date: Thu, 14 Nov 2024 22:56:20 +0000 Subject: [PATCH 1/3] Tests: Introduce `AdminSettings_UnitTestCase`. --- tests/phpunit/bootstrap.php | 3 +++ .../includes/AdminSettings_UnitTestCase.php | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/phpunit/includes/AdminSettings_UnitTestCase.php diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 2a947de..3899953 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -39,3 +39,6 @@ function _manually_load_plugin() { // Start up the WP testing environment. require "{$_tests_dir}/includes/bootstrap.php"; + +// Load unit test abstract classes. +require __DIR__ . '/includes/AdminSettings_UnitTestCase.php'; diff --git a/tests/phpunit/includes/AdminSettings_UnitTestCase.php b/tests/phpunit/includes/AdminSettings_UnitTestCase.php new file mode 100644 index 0000000..b9824ac --- /dev/null +++ b/tests/phpunit/includes/AdminSettings_UnitTestCase.php @@ -0,0 +1,25 @@ + Date: Thu, 28 Nov 2024 23:21:26 +0000 Subject: [PATCH 2/3] Tests: Implement `AdminSettings_UnitTestCase`. --- .../tests/AdminSettings/AdminSettings_GetSettingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/AdminSettings/AdminSettings_GetSettingTest.php b/tests/phpunit/tests/AdminSettings/AdminSettings_GetSettingTest.php index 9516f90..8ddfc14 100644 --- a/tests/phpunit/tests/AdminSettings/AdminSettings_GetSettingTest.php +++ b/tests/phpunit/tests/AdminSettings/AdminSettings_GetSettingTest.php @@ -10,7 +10,7 @@ * * @covers \AspireUpdate\Admin_Settings::get_setting */ -class AdminSettings_GetSettingTest extends WP_UnitTestCase { +class AdminSettings_GetSettingTest extends AdminSettings_UnitTestCase { /** * Test that the default 'api_host' value is retrieved. * From 398784b9d7c2f86739097bdadcb5b78972443ac6 Mon Sep 17 00:00:00 2001 From: costdev Date: Thu, 28 Nov 2024 23:46:53 +0000 Subject: [PATCH 3/3] Coding Standards: Exclude test classes from naming conventions. --- phpcs.xml.dist | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index af33bc2..081e4b7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -58,4 +58,12 @@ + + + + /tests/phpunit/tests/* + + + /tests/phpunit/tests/* +