Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#61148 closed task (blessed) (fixed)

Standardise assertions for remote HTTP tests

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 6.6 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

The order of assertions for remote HTTP request tests aren't entirely consistent, which can be a problem when an HTTP request fails and you see a test-specific assertion failure instead of information about why the request failed.

For every HTTP request test where the request is expected to succeed, the order should be:

  1. skipTestOnTimeout() so timeouts don't cause the test to fail
  2. assertNotWPError() so if the request results in an error then the full WP_Error message gets output
  3. HTTP status code assertions, if necessary
  4. All other assertions

Change History (3)

This ticket was mentioned in PR #6503 on WordPress/wordpress-develop by @johnbillion.


5 months ago
#1

  • Keywords has-patch has-unit-tests added

#2 @johnbillion
5 months ago

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

In 58108:

Build/Test Tools: Standardise the assertions for remote HTTP request tests.

This ensures that as much information as possible is shown when an HTTP request fails during an external HTTP test.

Fixes #61148

Note: See TracTickets for help on using tickets.