Make WordPress Core

Changeset 40287 for branches/4.1


Ignore:
Timestamp:
03/13/2017 10:37:53 PM (9 years ago)
Author:
ocean90
Message:

Tests: Use https URLs for wordpress.com assets in Tests_HTTP_Functions and Tests_Image_Functions.

Merge of [31258] and [31259] to the 4.1 branch.
See #31091.

Location:
branches/4.1
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1

  • branches/4.1/tests/phpunit/tests/http/functions.php

    r25002 r40287  
    66 */
    77class Tests_HTTP_Functions extends WP_UnitTestCase {
     8        public function setUp() {
     9                if ( ! extension_loaded( 'openssl' ) ) {
     10                        $this->markTestSkipped( 'Tests_HTTP_Functions requires openssl.' );
     11                }
     12
     13                parent::setUp();
     14        }
     15
    816        function test_head_request() {
    917                // this url give a direct 200 response
    10                 $url = 'http://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';
    1119                $response = wp_remote_head( $url );
    1220                $headers = wp_remote_retrieve_headers( $response );
     
    2028        function test_head_redirect() {
    2129                // this url will 301 redirect
    22                 $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
     30                $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
    2331                $response = wp_remote_head( $url );
    2432                $this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
     
    2634
    2735        function test_head_404() {
    28                 $url = 'http://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
     36                $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
    2937                $headers = wp_remote_head( $url );
    3038
     
    3442
    3543        function test_get_request() {
    36                 $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
     44                $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
    3745                $file = tempnam('/tmp', 'testfile');
    3846
     
    5260        function test_get_redirect() {
    5361                // this will redirect to asdftestblog1.files.wordpress.com
    54                 $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
     62                $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
    5563                $file = tempnam('/tmp', 'testfile');
    5664
     
    7078        function test_get_redirect_limit_exceeded() {
    7179                // this will redirect to asdftestblog1.files.wordpress.com
    72                 $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
     80                $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
    7381                $file = tempnam('/tmp', 'testfile');
    7482                // pretend we've already redirected 5 times
  • branches/4.1/tests/phpunit/tests/image/functions.php

    r29834 r40287  
    293293                        $this->markTestSkipped( 'jpeg support unavailable' );
    294294
    295                 $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
     295                if ( ! extension_loaded( 'openssl' ) ) {
     296                        $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url() requires openssl.' );
     297                }
     298
     299                $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
    296300                                                          0, 0, 100, 100, 100, 100, false,
    297301                                                          DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
     
    313317
    314318        public function test_wp_crop_image_url_not_exist() {
    315                 $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
     319                if ( ! extension_loaded( 'openssl' ) ) {
     320                        $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url_not_exist() requires openssl.' );
     321                }
     322
     323                $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
    316324                                                          0, 0, 100, 100, 100, 100 );
    317325                $this->assertInstanceOf( 'WP_Error', $file );
Note: See TracChangeset for help on using the changeset viewer.