Files
wordpress-develop/tests/phpunit/tests/functions/getStatusHeaderDesc.php
Sergey Biryukov 2a6b527f73 Tests: Improve the @group annotation accuracy and consistency.
Includes removing `.php` from some older group names, because most of the groups are no longer named based on the file containing the function, and sometimes functions move around, making the file-based group name inaccurate.

Props afercia, aristath, poena, SergeyBiryukov.
See #59647.

git-svn-id: https://develop.svn.wordpress.org/trunk@56971 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-19 13:51:04 +00:00

45 lines
973 B
PHP

<?php
/**
* Tests get_status_header_desc function
*
* @since 5.3.0
*
* @group functions
*
* @covers ::get_status_header_desc
*/
class Tests_Functions_GetStatusHeaderDesc extends WP_UnitTestCase {
/**
* @dataProvider data_get_status_header_desc
*
* @param int $code HTTP status code.
* @param string $expected Status description.
*/
public function test_get_status_header_desc( $code, $expected ) {
$this->assertSame( $expected, get_status_header_desc( $code ) );
}
/**
* Data provider for test_get_status_header_desc().
*
* @return array
*/
public function data_get_status_header_desc() {
return array(
array( 200, 'OK' ),
array( 301, 'Moved Permanently' ),
array( 404, 'Not Found' ),
array( 500, 'Internal Server Error' ),
// A string to make sure that the absint() is working.
array( '200', 'OK' ),
// Not recognized codes return empty strings.
array( 9999, '' ),
array( 'random', '' ),
);
}
}