Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54661 closed defect (bug) (fixed)

Remove the assertion in `filter_rest_url_for_leading_slash()`

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: Cc:

Description (last modified by johnbillion)

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.

Change History (3)

#1 @johnbillion
3 years ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 52390:

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

#2 @johnbillion
3 years ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core by sergey. View the logs.


3 years ago

Note: See TracTickets for help on using tickets.