Make WordPress Core

Ticket #60865: 60865.diff

File 60865.diff, 5.4 KB (added by SergeyBiryukov, 10 months ago)
  • tests/phpunit/tests/functions/wpRemoteFopen.php

     
    2727         */
    2828        public function test_wp_remote_fopen() {
    2929                // This URL gives a direct 200 response.
    30                 $url      = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg';
     30                $url      = 'https://s.w.org/screenshots/3.9/dashboard.png';
    3131                $response = wp_remote_fopen( $url );
    3232
    3333                $this->assertIsString( $response );
    34                 $this->assertSame( 40148, strlen( $response ) );
     34                $this->assertSame( 153204, strlen( $response ) );
    3535        }
    3636}
  • tests/phpunit/tests/http/functions.php

     
    1111         */
    1212        public function test_head_request() {
    1313                // This URL gives a direct 200 response.
    14                 $url      = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg';
     14                $url      = 'https://s.w.org/screenshots/3.9/dashboard.png';
    1515                $response = wp_remote_head( $url );
    1616
    1717                $this->skipTestOnTimeout( $response );
     
    2020
    2121                $this->assertIsArray( $response );
    2222
    23                 $this->assertSame( 'image/jpeg', $headers['Content-Type'] );
    24                 $this->assertSame( '40148', $headers['Content-Length'] );
     23                $this->assertSame( 'image/png', $headers['Content-Type'] );
     24                $this->assertSame( '153204', $headers['Content-Length'] );
    2525                $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
    2626        }
    2727
     
    3030         */
    3131        public function test_head_redirect() {
    3232                // This URL will 301 redirect.
    33                 $url      = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
     33                $url      = 'https://wp.org/screenshots/3.9/dashboard.png';
    3434                $response = wp_remote_head( $url );
    3535
    3636                $this->skipTestOnTimeout( $response );
     
    4141         * @covers ::wp_remote_head
    4242         */
    4343        public function test_head_404() {
    44                 $url      = 'https://asdftestblog1.wordpress.com/wp-content/uploads/2007/09/awefasdfawef.jpg';
     44                $url      = 'https://wordpress.org/screenshots/3.9/awefasdfawef.jpg';
    4545                $response = wp_remote_head( $url );
    4646
    4747                $this->skipTestOnTimeout( $response );
     
    5454         * @covers ::wp_remote_retrieve_response_code
    5555         */
    5656        public function test_get_request() {
    57                 $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
     57                $url = 'https://s.w.org/screenshots/3.9/dashboard.png';
    5858
    5959                $response = wp_remote_get( $url );
    6060
     
    6565                $this->assertIsArray( $response );
    6666
    6767                // Should return the same headers as a HEAD request.
    68                 $this->assertSame( 'image/jpeg', $headers['Content-Type'] );
    69                 $this->assertSame( '40148', $headers['Content-Length'] );
     68                $this->assertSame( 'image/png', $headers['Content-Type'] );
     69                $this->assertSame( '153204', $headers['Content-Length'] );
    7070                $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
    7171        }
    7272
     
    7676         * @covers ::wp_remote_retrieve_response_code
    7777         */
    7878        public function test_get_redirect() {
    79                 // This will redirect to asdftestblog1.files.wordpress.com.
    80                 $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
     79                // This will redirect to wordpress.org.
     80                $url = 'https://wp.org/screenshots/3.9/dashboard.png';
    8181
    8282                $response = wp_remote_get( $url );
    8383
     
    8686                $headers = wp_remote_retrieve_headers( $response );
    8787
    8888                // Should return the same headers as a HEAD request.
    89                 $this->assertSame( 'image/jpeg', $headers['Content-Type'] );
    90                 $this->assertSame( '40148', $headers['Content-Length'] );
     89                $this->assertSame( 'image/png', $headers['Content-Type'] );
     90                $this->assertSame( '153204', $headers['Content-Length'] );
    9191                $this->assertSame( 200, wp_remote_retrieve_response_code( $response ) );
    9292        }
    9393
     
    9595         * @covers ::wp_remote_get
    9696         */
    9797        public function test_get_redirect_limit_exceeded() {
    98                 // This will redirect to asdftestblog1.files.wordpress.com.
    99                 $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
     98                // This will redirect to wordpress.org.
     99                $url = 'https://wp.org/screenshots/3.9/dashboard.png';
    100100
    101101                // Pretend we've already redirected 5 times.
    102102                $response = wp_remote_get( $url, array( 'redirection' => -1 ) );
  • tests/phpunit/tests/image/functions.php

     
    638638         */
    639639        public function test_wp_crop_image_with_url() {
    640640                $file = wp_crop_image(
    641                         'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
     641                        'https://s.w.org/screenshots/3.9/dashboard.png',
    642642                        0,
    643643                        0,
    644644                        100,
     
    646646                        100,
    647647                        100,
    648648                        false,
    649                         DIR_TESTDATA . '/images/' . __FUNCTION__ . '.jpg'
     649                        DIR_TESTDATA . '/images/' . __FUNCTION__ . '.png'
    650650                );
    651651
    652652                if ( is_wp_error( $file ) && $file->get_error_code() === 'invalid_image' ) {
     
    687687         */
    688688        public function test_wp_crop_image_should_fail_with_wp_error_object_if_url_does_not_exist() {
    689689                $file = wp_crop_image(
    690                         'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
     690                        'https://wordpress.org/screenshots/3.9/canoladoesnotexist.jpg',
    691691                        0,
    692692                        0,
    693693                        100,