From f28e3d0b88eec255e171d01ec4f66a4d7486e399 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 18 Jul 2021 13:45:57 +0000 Subject: [PATCH] Tests: Require the `WP_REST_Test_Controller` class in `WP_REST_Controller` tests. This avoids a "Class not found" PHP fatal error when running these tests separately. Follow-up to [38832]. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51452 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/rest-api/rest-controller.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/phpunit/tests/rest-api/rest-controller.php b/tests/phpunit/tests/rest-api/rest-controller.php index 8a4d41bc29..827077c63f 100644 --- a/tests/phpunit/tests/rest-api/rest-controller.php +++ b/tests/phpunit/tests/rest-api/rest-controller.php @@ -11,6 +11,11 @@ */ class WP_Test_REST_Controller extends WP_Test_REST_TestCase { + public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { + // Load the WP_REST_Test_Controller class if not already loaded. + require_once __DIR__ . '/rest-test-controller.php'; + } + public function setUp() { parent::setUp(); $this->request = new WP_REST_Request(