WordPress.org

Make WordPress Core

Changeset 38514


Ignore:
Timestamp:
09/02/2016 10:52:48 PM (3 years ago)
Author:
johnbillion
Message:

Embeds: Clarify some assertion failure messages and correct a test URL for Twitter timelines.

See #32360

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/oembed.php

    r38512 r38514  
    9393            }
    9494
    95             $this->assertSame( 200, wp_remote_retrieve_response_code( $r ), $msg );
     95            $http_code    = wp_remote_retrieve_response_code( $r );
     96            $http_message = wp_remote_retrieve_response_message( $r );
     97            $this->assertSame( 200, $http_code, "{$msg}\n- HTTP response code: {$http_code} {$http_message}" );
    9698
    9799        }
     
    135137                'discover' => false,
    136138            ) );
    137             $this->assertNotFalse( $provider, $msg );
     139            $this->assertNotFalse( $provider, "{$msg}\n- No oEmbed provider found." );
    138140
    139141            $data = self::$oembed->fetch( $provider, $url, $args );
     
    167169            }
    168170
    169             $this->assertSame( 200, wp_remote_retrieve_response_code( $r['response'] ), $msg );
     171            $http_code    = wp_remote_retrieve_response_code( $r['response'] );
     172            $http_message = wp_remote_retrieve_response_message( $r['response'] );
     173            $this->assertSame( 200, $http_code, "{$msg}\n- HTTP response code: {$http_code} {$http_message}" );
    170174
    171175            // Test response
     
    343347            'discover' => false,
    344348        ) );
    345         $this->assertNotFalse( $provider, $msg );
     349        $this->assertNotFalse( $provider, "{$msg}\n- No oEmbed provider found." );
    346350        $data = self::$oembed->fetch( $provider, $url, $args );
    347351
     
    370374        }
    371375
    372         $this->assertTrue( in_array( wp_remote_retrieve_response_code( $r['response'] ), array(
     376        $http_code    = wp_remote_retrieve_response_code( $r['response'] );
     377        $http_message = wp_remote_retrieve_response_message( $r['response'] );
     378        $this->assertContains( $http_code, array(
    373379            200,
    374380            400,
    375381            404,
    376         ), true ), $msg );
     382        ), "{$msg}\n- HTTP response code: {$http_code} {$http_message}" );
    377383
    378384        if ( false === $data ) {
     
    580586                $providers['twitter-timeline'],
    581587                array(
    582                     'https://twitter.com/wordpress',
     588                    'https://twitter.com/TwitterDev/timelines/539487832448843776',
    583589                ),
    584590            ),
Note: See TracChangeset for help on using the changeset viewer.