From f5ae410c33dafdd794fa652f3089233942d243ce Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 24 Jun 2021 10:04:41 +0000 Subject: [PATCH] Tests: Require PHPUnit >= 6 in tests using `::createPartialMock()`. This avoids a "Call to undefined method" fatal error when running the tests with PHPUnit 5.4.x, which WordPress still supports as the minimum version. Follow-up to [48945], [48947]. See #52625. git-svn-id: https://develop.svn.wordpress.org/trunk@51226 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/rest-api/rest-request.php | 3 +++ tests/phpunit/tests/rest-api/rest-server.php | 1 + 2 files changed, 4 insertions(+) diff --git a/tests/phpunit/tests/rest-api/rest-request.php b/tests/phpunit/tests/rest-api/rest-request.php index 6ec0491f0c..20616e05f6 100644 --- a/tests/phpunit/tests/rest-api/rest-request.php +++ b/tests/phpunit/tests/rest-api/rest-request.php @@ -1008,6 +1008,7 @@ class Tests_REST_Request extends WP_UnitTestCase { /** * @ticket 51255 + * @requires PHPUnit >= 6 */ public function test_route_level_validate_callback() { $request = new WP_REST_Request(); @@ -1032,6 +1033,7 @@ class Tests_REST_Request extends WP_UnitTestCase { /** * @ticket 51255 + * @requires PHPUnit >= 6 */ public function test_route_level_validate_callback_no_parameter_callbacks() { $request = new WP_REST_Request(); @@ -1051,6 +1053,7 @@ class Tests_REST_Request extends WP_UnitTestCase { /** * @ticket 51255 + * @requires PHPUnit >= 6 */ public function test_route_level_validate_callback_is_not_executed_if_parameter_validation_fails() { $request = new WP_REST_Request(); diff --git a/tests/phpunit/tests/rest-api/rest-server.php b/tests/phpunit/tests/rest-api/rest-server.php index 0dbc308bf9..e8038adcb7 100644 --- a/tests/phpunit/tests/rest-api/rest-server.php +++ b/tests/phpunit/tests/rest-api/rest-server.php @@ -1571,6 +1571,7 @@ class Tests_REST_Server extends WP_Test_REST_TestCase { /** * @ticket 50244 + * @requires PHPUnit >= 6 */ public function test_callbacks_are_not_executed_if_request_validation_fails() { $callback = $this->createPartialMock( 'stdClass', array( '__invoke' ) );