From 7c0f7cbbdab75c190a27019db1a1f4c3f9f46288 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 19 Dec 2021 14:27:22 +0000 Subject: [PATCH] Build/Test Tools: Remove the assertion in `filter_rest_url_for_leading_slash()`. This assertion can mask the fact that some other tests don't perform an assertion. Fixes #54661 git-svn-id: https://develop.svn.wordpress.org/trunk@52390 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/testcase-rest-controller.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/includes/testcase-rest-controller.php b/tests/phpunit/includes/testcase-rest-controller.php index a0b96545bf..67a7970b66 100644 --- a/tests/phpunit/includes/testcase-rest-controller.php +++ b/tests/phpunit/includes/testcase-rest-controller.php @@ -45,7 +45,14 @@ abstract class WP_Test_REST_Controller_Testcase extends WP_Test_REST_TestCase { } // Make sure path for rest_url has a leading slash for proper resolution. - $this->assertTrue( 0 === strpos( $path, '/' ), 'REST API URL should have a leading slash.' ); + if ( 0 !== strpos( $path, '/' ) ) { + $this->fail( + sprintf( + 'REST API URL "%s" should have a leading slash.', + $path + ) + ); + } return $url; }