Changeset 47122 for trunk/tests/phpunit/tests/http/functions.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/http/functions.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/http/functions.php
r46682 r47122 16 16 17 17 function test_head_request() { 18 // this url give a direct 200 response18 // This URL gives a direct 200 response. 19 19 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg'; 20 20 $response = wp_remote_head( $url ); … … 32 32 33 33 function test_head_redirect() { 34 // this url will 301 redirect34 // This URL will 301 redirect. 35 35 $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg'; 36 36 $response = wp_remote_head( $url ); … … 59 59 $this->assertInternalType( 'array', $response ); 60 60 61 // should return the same headers as a head request61 // Should return the same headers as a HEAD request. 62 62 $this->assertEquals( 'image/jpeg', $headers['content-type'] ); 63 63 $this->assertEquals( '40148', $headers['content-length'] ); … … 66 66 67 67 function test_get_redirect() { 68 // this will redirect to asdftestblog1.files.wordpress.com68 // This will redirect to asdftestblog1.files.wordpress.com. 69 69 $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg'; 70 70 … … 75 75 $headers = wp_remote_retrieve_headers( $response ); 76 76 77 // should return the same headers as a head request77 // Should return the same headers as a HEAD request. 78 78 $this->assertEquals( 'image/jpeg', $headers['content-type'] ); 79 79 $this->assertEquals( '40148', $headers['content-length'] ); … … 82 82 83 83 function test_get_redirect_limit_exceeded() { 84 // this will redirect to asdftestblog1.files.wordpress.com84 // This will redirect to asdftestblog1.files.wordpress.com. 85 85 $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg'; 86 86 87 // pretend we've already redirected 5 times87 // Pretend we've already redirected 5 times. 88 88 $response = wp_remote_get( $url, array( 'redirection' => -1 ) ); 89 89 … … 184 184 */ 185 185 function test_get_cookie_host_only() { 186 // emulate WP_Http::request() internals186 // Emulate WP_Http::request() internals. 187 187 $requests_response = new Requests_Response(); 188 188 … … 195 195 $response = $http_response->to_array(); 196 196 197 // check the host_only flag in the resulting WP_Http_Cookie197 // Check the host_only flag in the resulting WP_Http_Cookie. 198 198 $cookie = wp_remote_retrieve_cookie( $response, 'test' ); 199 199 $this->assertEquals( $cookie->domain, 'wordpress.org' ); 200 200 $this->assertFalse( $cookie->host_only, 'host-only flag not set' ); 201 201 202 // regurgitate (Requests_Cookie -> WP_Http_Cookie -> Requests_Cookie)202 // Regurgitate (Requests_Cookie -> WP_Http_Cookie -> Requests_Cookie). 203 203 $cookies = WP_Http::normalize_cookies( wp_remote_retrieve_cookies( $response ) ); 204 204 $this->assertFalse( $cookies['test']->flags['host-only'], 'host-only flag data lost' );
Note: See TracChangeset
for help on using the changeset viewer.