wordpress-develop/tests/phpunit/tests/functions/getStatusHeaderDesc.php
Sergey Biryukov cff706c8f0 Tests: Correct the order of expected and actual values in get_status_header_desc() tests.
This corrects the order of the parameters when used in assertions so if/when they fail the failure message is correct.

Follow-up to [46107].

See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52773 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 12:36:04 +00:00

44 lines
950 B
PHP

<?php
/**
* Tests get_status_header_desc function
*
* @since 5.3.0
*
* @group functions.php
* @covers ::get_status_header_desc
*/
class Tests_Functions_GetStatusHeaderDesc extends WP_UnitTestCase {
/**
* @dataProvider _status_strings
*
* @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 _status_strings() {
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', '' ),
);
}
}