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; }