Changeset 42343 for trunk/tests/phpunit/tests/http/functions.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/http/functions.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/http/functions.php
r41279 r42343 16 16 function test_head_request() { 17 17 // this url give a direct 200 response 18 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';18 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg'; 19 19 $response = wp_remote_head( $url ); 20 $headers = wp_remote_retrieve_headers( $response );20 $headers = wp_remote_retrieve_headers( $response ); 21 21 22 22 $this->assertInternalType( 'array', $response ); 23 23 24 24 $this->assertEquals( 'image/jpeg', $headers['content-type'] ); 25 25 $this->assertEquals( '40148', $headers['content-length'] ); … … 29 29 function test_head_redirect() { 30 30 // this url will 301 redirect 31 $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';31 $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg'; 32 32 $response = wp_remote_head( $url ); 33 33 $this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) ); … … 35 35 36 36 function test_head_404() { 37 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';37 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg'; 38 38 $headers = wp_remote_head( $url ); 39 39 … … 45 45 46 46 $response = wp_remote_get( $url ); 47 $headers = wp_remote_retrieve_headers( $response );47 $headers = wp_remote_retrieve_headers( $response ); 48 48 49 49 $this->assertInternalType( 'array', $response ); 50 50 51 51 // should return the same headers as a head request 52 52 $this->assertEquals( 'image/jpeg', $headers['content-type'] ); … … 60 60 61 61 $response = wp_remote_get( $url ); 62 $headers = wp_remote_retrieve_headers( $response );62 $headers = wp_remote_retrieve_headers( $response ); 63 63 64 64 // should return the same headers as a head request … … 109 109 $url = 'http://example.org'; 110 110 111 $response = wp_remote_get( $url, array( 112 'cookies' => array( 113 new WP_Http_Cookie( array( 'name' => 'test', 'value' => 'foo' ) ), 114 ), 115 ) ); 111 $response = wp_remote_get( 112 $url, array( 113 'cookies' => array( 114 new WP_Http_Cookie( 115 array( 116 'name' => 'test', 117 'value' => 'foo', 118 ) 119 ), 120 ), 121 ) 122 ); 116 123 $cookies = wp_remote_retrieve_cookies( $response ); 117 124 … … 130 137 $url = 'http://example.org'; 131 138 132 $response = wp_remote_get( $url, array( 133 'cookies' => array( 134 'test' => 'foo', 135 ), 136 ) ); 139 $response = wp_remote_get( 140 $url, array( 141 'cookies' => array( 142 'test' => 'foo', 143 ), 144 ) 145 ); 137 146 $cookies = wp_remote_retrieve_cookies( $response ); 138 147
Note: See TracChangeset
for help on using the changeset viewer.