Make WordPress Core

Opened 3 months ago

Closed 2 months ago

#65527 closed defect (bug) (fixed)

move the tst test_http_response_code_constants from http.php to getStatusHeaderDesc.php

Reported by: pbearne Owned by: pbearne
Priority: normal Milestone: 7.1
Component: Build/Test Tools Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: tests

Description

Let's get all tests into the same file

Change History (3)

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


3 months ago
#1

  • Keywords has-patch has-unit-tests added

Moves test_http_response_code_constants() from the HTTP API test file into the test class for get_status_header_desc(), so all tests for that function live in one place.

What the problem was:

  • test_http_response_code_constants() exercises get_status_header_desc() but was located in tests/phpunit/tests/http/http.php (Tests_HTTP_HTTP).

What the fix does:

  • Moves the test method into Tests_Functions_GetStatusHeaderDesc (tests/phpunit/tests/functions/getStatusHeaderDesc.php).
  • Drops the redundant method-level @covers ::get_status_header_desc, as the class-level docblock already declares it.

Approach and why:

  • Test body is unchanged; this only relocates it to the canonical file for the function under test, improving discoverability and grouping.

Trac ticket: https://core.trac.wordpress.org/ticket/65527

## Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.8
Used for: Ticket analysis and tests. All changes were reviewed, validated against the codebase, and are taken responsibility for by me.

#2 @SergeyBiryukov
2 months ago

  • Milestone Awaiting Review7.1

#3 @SergeyBiryukov
2 months ago

  • Resolutionfixed
  • Status assignedclosed

In 62593:

Tests: Move the HTTP response codes test for consistency.

While the test was originally written to verify that the WP_Http class has all the HTTP response codes as constants, it ensures that the constants match the response codes stored in the $wp_header_to_desc global used by the get_status_header_desc() function, so the latter's unit test file appears to be the logical placement.

Follow-up to [36749], [46107].

Props pbearne, khokansardar, SergeyBiryukov.
Fixes #65527.

Note: See TracTickets for help on using tickets.