From 20d906d01bc974a3eb08da0937eba79843af690c Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 20 Jul 2021 16:20:47 +0200 Subject: [PATCH] IsUnitTestTrait: update test class list Update the test class list based on changes in WP Core: * The `Block_Supported_Styles_Test` was never a `TestCase`, but was a concrete test placed in the wrong directory. * The `PHPUnit_Adapter_TestCase` class was added to allow for PHPUnit cross-version support. Other than that, the list is now alphabetized within each category and the categories are annotated with comments. --- WordPress/Helpers/IsUnitTestTrait.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/WordPress/Helpers/IsUnitTestTrait.php b/WordPress/Helpers/IsUnitTestTrait.php index 801c1e5a5b..b3712da57c 100644 --- a/WordPress/Helpers/IsUnitTestTrait.php +++ b/WordPress/Helpers/IsUnitTestTrait.php @@ -79,16 +79,21 @@ trait IsUnitTestTrait { * @var string[] */ protected $known_test_classes = array( - 'WP_UnitTestCase_Base' => true, + // Base test cases. 'WP_UnitTestCase' => true, + 'WP_UnitTestCase_Base' => true, + 'PHPUnit_Adapter_TestCase' => true, + + // Domain specific base test cases. 'WP_Ajax_UnitTestCase' => true, - 'Block_Supported_Styles_Test' => true, 'WP_Canonical_UnitTestCase' => true, - 'WP_Test_REST_TestCase' => true, 'WP_Test_REST_Controller_Testcase' => true, 'WP_Test_REST_Post_Type_Controller_Testcase' => true, + 'WP_Test_REST_TestCase' => true, 'WP_Test_XML_TestCase' => true, 'WP_XMLRPC_UnitTestCase' => true, + + // PHPUnit native test cases. 'PHPUnit_Framework_TestCase' => true, 'PHPUnit\Framework\TestCase' => true, // PHPUnit native TestCase class when imported via use statement.