diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php index d8b703bf9c..838fbe8140 100644 --- a/src/wp-includes/class-http.php +++ b/src/wp-includes/class-http.php @@ -21,6 +21,10 @@ class WP_Http { // Aliases for HTTP response codes. + const HTTP_CONTINUE = 100; + const SWITCHING_PROTOCOLS = 101; + const PROCESSING = 102; + const OK = 200; const CREATED = 201; const ACCEPTED = 202; diff --git a/tests/phpunit/tests/http/http.php b/tests/phpunit/tests/http/http.php index 80b83f9d33..74eda29e21 100644 --- a/tests/phpunit/tests/http/http.php +++ b/tests/phpunit/tests/http/http.php @@ -102,4 +102,20 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase { - ://example.com - assumed path in PHP >= 5.4.7, fails in <5.4.7 */ } + + /** + * @ticket 35426 + */ + public function test_http_response_code_constants() { + global $wp_header_to_desc; + + $ref = new ReflectionClass( 'WP_Http' ); + $constants = $ref->getConstants(); + + // This primes the `$wp_header_to_desc` global: + get_status_header_desc( 200 ); + + $this->assertEquals( array_keys( $wp_header_to_desc ), array_values( $constants ) ); + + } }