Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#50986 closed defect (bug) (fixed)

PHPUnit tests: unregister custom settings after rest-api tests

Reported by: david.binda Owned by: SergeyBiryukov
Priority: normal Milestone: 5.6
Component: REST API Version: 4.7
Severity: minor Keywords:
Cc: Focuses:

Description

Most of the tests in tests/phpunit/tests/rest-api/rest-settings-controller.php are removing the settings they after performing the assertions.

However, not all of them do, which means that those settings may be leaking to other tests. This is not breaking any tests at the moment, but may cause issues when the order of the tests changes.

Attachments (1)

50986.diff (1.4 KB ) - added by david.binda 6 years ago.

Download all attachments as: .zip

Change History (3)

@david.binda
6 years ago

#1 @TimothyBlynJacobs
6 years ago

  • Component GeneralREST API
  • Milestone Awaiting Review5.6
  • Version4.7

Thanks for the patch @davidbinda!

Could we move all the unregister_setting calls to tearDown? That way we can guarantee they get executed if an assertion fails?

#2 @SergeyBiryukov
6 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 48791:

Tests: Consistently unregister custom settings after performing assertions in WP_Test_REST_Settings_Controller.

This ensures that those settings don't leak to other tests.

Props david.binda, TimothyBlynJacobs, SergeyBiryukov.
Fixes #50986.

Note: See TracTickets for help on using tickets.