Changeset 57997 for branches/5.4
- Timestamp:
- 04/15/2024 12:30:10 PM (8 months ago)
- Location:
- branches/5.4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.4
-
branches/5.4/tests/phpunit/tests/functions/wpRemoteFopen.php
r47212 r57997 26 26 public function test_wp_remote_fopen() { 27 27 // This URL gives a direct 200 response. 28 $url = 'https:// asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';28 $url = 'https://s.w.org/screenshots/3.9/dashboard.png'; 29 29 $response = wp_remote_fopen( $url ); 30 30 31 $this->assertI nternalType( 'string',$response );32 $this->assert Equals( 40148, strlen( $response ) );31 $this->assertIsString( $response ); 32 $this->assertSame( 153204, strlen( $response ) ); 33 33 } 34 34 } -
branches/5.4/tests/phpunit/tests/http/functions.php
r47122 r57997 17 17 function test_head_request() { 18 18 // This URL gives a direct 200 response. 19 $url = 'https:// asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';19 $url = 'https://s.w.org/screenshots/3.9/dashboard.png'; 20 20 $response = wp_remote_head( $url ); 21 21 … … 26 26 $this->assertInternalType( 'array', $response ); 27 27 28 $this->assert Equals( 'image/jpeg', $headers['content-type'] );29 $this->assert Equals( '40148', $headers['content-length'] );30 $this->assert Equals( '200', wp_remote_retrieve_response_code( $response ) );28 $this->assertSame( 'image/png', $headers['Content-Type'] ); 29 $this->assertSame( '153204', $headers['Content-Length'] ); 30 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 31 31 } 32 32 33 33 function test_head_redirect() { 34 34 // This URL will 301 redirect. 35 $url = 'https:// asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';35 $url = 'https://wp.org/screenshots/3.9/dashboard.png'; 36 36 $response = wp_remote_head( $url ); 37 37 … … 40 40 } 41 41 42 function test_head_404() { 43 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg'; 42 /** 43 * @covers ::wp_remote_head 44 */ 45 public function test_head_404() { 46 $url = 'https://wordpress.org/screenshots/3.9/awefasdfawef.jpg'; 44 47 $response = wp_remote_head( $url ); 45 48 … … 48 51 } 49 52 50 function test_get_request() { 51 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg'; 53 /** 54 * @covers ::wp_remote_get 55 * @covers ::wp_remote_retrieve_headers 56 * @covers ::wp_remote_retrieve_response_code 57 */ 58 public function test_get_request() { 59 $url = 'https://s.w.org/screenshots/3.9/dashboard.png'; 52 60 53 61 $response = wp_remote_get( $url ); … … 60 68 61 69 // Should return the same headers as a HEAD request. 62 $this->assert Equals( 'image/jpeg', $headers['content-type'] );63 $this->assert Equals( '40148', $headers['content-length'] );64 $this->assert Equals( '200', wp_remote_retrieve_response_code( $response ) );70 $this->assertSame( 'image/png', $headers['Content-Type'] ); 71 $this->assertSame( '153204', $headers['Content-Length'] ); 72 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 65 73 } 66 74 67 75 function test_get_redirect() { 68 // This will redirect to asdftestblog1.files.wordpress.com.69 $url = 'https:// asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';76 // This will redirect to wordpress.org. 77 $url = 'https://wp.org/screenshots/3.9/dashboard.png'; 70 78 71 79 $response = wp_remote_get( $url ); … … 76 84 77 85 // Should return the same headers as a HEAD request. 78 $this->assert Equals( 'image/jpeg', $headers['content-type'] );79 $this->assert Equals( '40148', $headers['content-length'] );80 $this->assert Equals( '200', wp_remote_retrieve_response_code( $response ) );86 $this->assertSame( 'image/png', $headers['Content-Type'] ); 87 $this->assertSame( '153204', $headers['Content-Length'] ); 88 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 81 89 } 82 90 83 91 function test_get_redirect_limit_exceeded() { 84 // This will redirect to asdftestblog1.files.wordpress.com.85 $url = 'https:// asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';92 // This will redirect to wordpress.org. 93 $url = 'https://wp.org/screenshots/3.9/dashboard.png'; 86 94 87 95 // Pretend we've already redirected 5 times. -
branches/5.4/tests/phpunit/tests/image/functions.php
r48366 r57997 336 336 337 337 $file = wp_crop_image( 338 'https:// asdftestblog1.files.wordpress.com/2008/04/canola.jpg',338 'https://s.w.org/screenshots/3.9/dashboard.png', 339 339 0, 340 340 0, … … 344 344 100, 345 345 false, 346 DIR_TESTDATA . '/images/' . __FUNCTION__ . '. jpg'346 DIR_TESTDATA . '/images/' . __FUNCTION__ . '.png' 347 347 ); 348 348 $this->assertNotWPError( $file ); … … 375 375 376 376 $file = wp_crop_image( 377 'https:// asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',377 'https://wordpress.org/screenshots/3.9/canoladoesnotexist.jpg', 378 378 0, 379 379 0,
Note: See TracChangeset
for help on using the changeset viewer.