Changeset 57995
- Timestamp:
- 04/15/2024 12:27:18 PM (9 months ago)
- Location:
- branches/5.6
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
-
branches/5.6/tests/phpunit/tests/functions/wpRemoteFopen.php
r49006 r57995 27 27 public function test_wp_remote_fopen() { 28 28 // This URL gives a direct 200 response. 29 $url = 'https:// asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';29 $url = 'https://s.w.org/screenshots/3.9/dashboard.png'; 30 30 $response = wp_remote_fopen( $url ); 31 31 32 32 $this->assertInternalType( 'string', $response ); 33 $this->assertSame( 40148, strlen( $response ) );33 $this->assertSame( 153204, strlen( $response ) ); 34 34 } 35 35 } -
branches/5.6/tests/phpunit/tests/http/functions.php
r49025 r57995 10 10 function test_head_request() { 11 11 // This URL gives a direct 200 response. 12 $url = 'https:// asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';12 $url = 'https://s.w.org/screenshots/3.9/dashboard.png'; 13 13 $response = wp_remote_head( $url ); 14 14 … … 19 19 $this->assertInternalType( 'array', $response ); 20 20 21 $this->assertSame( 'image/ jpeg', $headers['content-type'] );22 $this->assertSame( ' 40148', $headers['content-length'] );21 $this->assertSame( 'image/png', $headers['Content-Type'] ); 22 $this->assertSame( '153204', $headers['Content-Length'] ); 23 23 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 24 24 } … … 26 26 function test_head_redirect() { 27 27 // This URL will 301 redirect. 28 $url = 'https:// asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';28 $url = 'https://wp.org/screenshots/3.9/dashboard.png'; 29 29 $response = wp_remote_head( $url ); 30 30 … … 33 33 } 34 34 35 function test_head_404() { 36 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg'; 35 /** 36 * @covers ::wp_remote_head 37 */ 38 public function test_head_404() { 39 $url = 'https://wordpress.org/screenshots/3.9/awefasdfawef.jpg'; 37 40 $response = wp_remote_head( $url ); 38 41 … … 41 44 } 42 45 43 function test_get_request() { 44 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg'; 46 /** 47 * @covers ::wp_remote_get 48 * @covers ::wp_remote_retrieve_headers 49 * @covers ::wp_remote_retrieve_response_code 50 */ 51 public function test_get_request() { 52 $url = 'https://s.w.org/screenshots/3.9/dashboard.png'; 45 53 46 54 $response = wp_remote_get( $url ); … … 53 61 54 62 // Should return the same headers as a HEAD request. 55 $this->assertSame( 'image/ jpeg', $headers['content-type'] );56 $this->assertSame( ' 40148', $headers['content-length'] );63 $this->assertSame( 'image/png', $headers['Content-Type'] ); 64 $this->assertSame( '153204', $headers['Content-Length'] ); 57 65 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 58 66 } 59 67 60 68 function test_get_redirect() { 61 // This will redirect to asdftestblog1.files.wordpress.com.62 $url = 'https:// asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';69 // This will redirect to wordpress.org. 70 $url = 'https://wp.org/screenshots/3.9/dashboard.png'; 63 71 64 72 $response = wp_remote_get( $url ); … … 69 77 70 78 // Should return the same headers as a HEAD request. 71 $this->assertSame( 'image/ jpeg', $headers['content-type'] );72 $this->assertSame( ' 40148', $headers['content-length'] );79 $this->assertSame( 'image/png', $headers['Content-Type'] ); 80 $this->assertSame( '153204', $headers['Content-Length'] ); 73 81 $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) ); 74 82 } 75 83 76 84 function test_get_redirect_limit_exceeded() { 77 // This will redirect to asdftestblog1.files.wordpress.com.78 $url = 'https:// asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';85 // This will redirect to wordpress.org. 86 $url = 'https://wp.org/screenshots/3.9/dashboard.png'; 79 87 80 88 // Pretend we've already redirected 5 times. -
branches/5.6/tests/phpunit/tests/image/functions.php
r49450 r57995 369 369 public function test_wp_crop_image_url() { 370 370 $file = wp_crop_image( 371 'https:// asdftestblog1.files.wordpress.com/2008/04/canola.jpg',371 'https://s.w.org/screenshots/3.9/dashboard.png', 372 372 0, 373 373 0, … … 377 377 100, 378 378 false, 379 DIR_TESTDATA . '/images/' . __FUNCTION__ . '. jpg'379 DIR_TESTDATA . '/images/' . __FUNCTION__ . '.png' 380 380 ); 381 381 … … 412 412 public function test_wp_crop_image_url_not_exist() { 413 413 $file = wp_crop_image( 414 'https:// asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',414 'https://wordpress.org/screenshots/3.9/canoladoesnotexist.jpg', 415 415 0, 416 416 0,
Note: See TracChangeset
for help on using the changeset viewer.