Make WordPress Core

Changeset 38453


Ignore:
Timestamp:
08/30/2016 06:30:51 PM (10 years ago)
Author:
johnbillion
Message:

HTTP API: Separate the test for wp_parse_url() with -1 as its component into a separate test, so the remaining tests can use strict type checking. This helps avoid gotches with the potentially empty values (ie. null) that we're testing for.

See #36356

File:
1 edited

Legend:

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

    r38452 r38453  
    118118        /**
    119119         * @ticket 36356
     120         */
     121        function test_wp_parse_url_with_default_component() {
     122                $actual = wp_parse_url( self::$full_test_url, -1 );
     123                $this->assertEquals( array(
     124                        'scheme'   => 'http',
     125                        'host'     => 'host.name',
     126                        'port'     => 9090,
     127                        'user'     => 'username',
     128                        'pass'     => 'password',
     129                        'path'     => '/path',
     130                        'query'    => 'arg1=value1&arg2=value2',
     131                        'fragment' => 'anchor',
     132                ), $actual );
     133        }
     134
     135        /**
     136         * @ticket 36356
    120137         *
    121138         * @dataProvider parse_url_component_testcases
     
    123140        function test_wp_parse_url_with_component( $url, $component, $expected ) {
    124141                $actual = wp_parse_url( $url, $component );
    125                 $this->assertEquals( $expected, $actual );
     142                $this->assertSame( $expected, $actual );
    126143        }
    127144
     
    129146                // 0: The URL, 1: The requested component, 2: The expected resulting component.
    130147                return array(
    131                         array( self::$full_test_url, -1, array(
    132                                 'scheme'   => 'http',
    133                                 'host'     => 'host.name',
    134                                 'port'     => 9090,
    135                                 'user'     => 'username',
    136                                 'pass'     => 'password',
    137                                 'path'     => '/path',
    138                                 'query'    => 'arg1=value1&arg2=value2',
    139                                 'fragment' => 'anchor',
    140                         ) ),
    141148                        array( self::$full_test_url, PHP_URL_SCHEME, 'http' ),
    142149                        array( self::$full_test_url, PHP_URL_USER, 'username' ),
Note: See TracChangeset for help on using the changeset viewer.