[wp-trac] [WordPress Trac] #54661: Remove the assertion in `filter_rest_url_for_leading_slash()`

WordPress Trac noreply at wordpress.org
Sun Dec 19 14:28:59 UTC 2021


#54661: Remove the assertion in `filter_rest_url_for_leading_slash()`
------------------------------+--------------------------
 Reporter:  johnbillion       |       Owner:  johnbillion
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:  5.9
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:  fixed
 Keywords:                    |     Focuses:
------------------------------+--------------------------
Description changed by johnbillion:

Old description:

> In https://github.com/WordPress/wordpress-develop/pull/1995 I identified
> some tests which work with faulty assumptions about the data they're
> testing. While debugging this I noticed that the
> `WP_Test_REST_Controller_Testcase::filter_rest_url_for_leading_slash()`
> method performs an assertion which masks the fact that actual tests are
> not performing any assertions.
>
> For example the
> `WP_Test_REST_Tags_Controller::test_get_terms_post_args_paging()` test is
> faulty and does not perform any assertions, but this is not reported by
> PHPUnit because
> ``WP_Test_REST_Controller_Testcase::filter_rest_url_for_leading_slash()`
> performs 21 assertions during the test run.
>
> The assertion in
> `WP_Test_REST_Controller_Testcase::filter_rest_url_for_leading_slash()`
> should be converted to a conditional call to `fail()` so that tests which
> don't perform any assertions get correctly reported.

New description:

 In https://github.com/WordPress/wordpress-develop/pull/1995 I identified
 some tests which work with faulty assumptions about the data they're
 testing. While debugging this I noticed that the
 `WP_Test_REST_Controller_Testcase::filter_rest_url_for_leading_slash()`
 method performs an assertion which masks the fact that actual tests are
 not performing any assertions.

 For example the
 `WP_Test_REST_Tags_Controller::test_get_terms_post_args_paging()` test is
 faulty and does not perform any assertions, but this is not reported by
 PHPUnit because
 `WP_Test_REST_Controller_Testcase::filter_rest_url_for_leading_slash()`
 performs 21 assertions during the test run.

 The assertion in
 `WP_Test_REST_Controller_Testcase::filter_rest_url_for_leading_slash()`
 should be converted to a conditional call to `fail()` so that tests which
 don't perform any assertions get correctly reported.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54661#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list