Make WordPress Core


Ignore:
Timestamp:
02/26/2016 12:25:10 AM (10 years ago)
Author:
johnbillion
Message:

Correct some more tests which were using example.org instead of WP_TESTS_DOMAIN.

See #34000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions/referer.php

    r36266 r36717  
    2424
    2525    public function _fake_subfolder_install() {
    26         return 'http://example.org/subfolder';
     26        return 'http://' . WP_TESTS_DOMAIN . '/subfolder';
    2727    }
    2828
    2929    public function filter_allowed_redirect_hosts( $hosts ) {
    30         $hosts[] = 'another.example.org';
     30        $hosts[] = 'another.' . WP_TESTS_DOMAIN;
    3131
    3232        return $hosts;
     
    4040
    4141    public function test_from_request_same_url() {
    42         $_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/test.php?id=123' );
     42        $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?id=123' );
    4343        $_SERVER['REQUEST_URI']       = addslashes( '/test.php?id=123' );
    4444        $this->assertFalse( wp_get_referer() );
     
    4646
    4747    public function test_from_request_different_resource() {
    48         $_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/another.php?id=123' );
     48        $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123' );
    4949        $_SERVER['REQUEST_URI']       = addslashes( '/test.php?id=123' );
    50         $this->assertSame( 'http://example.org/another.php?id=123', wp_get_referer() );
     50        $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123', wp_get_referer() );
    5151    }
    5252
    5353    public function test_from_request_different_query_args() {
    54         $_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/test.php?another=555' );
     54        $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?another=555' );
    5555        $_SERVER['REQUEST_URI']       = addslashes( '/test.php?id=123' );
    56         $this->assertSame( 'http://example.org/test.php?another=555', wp_get_referer() );
     56        $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/test.php?another=555', wp_get_referer() );
    5757    }
    5858
     
    6363        add_filter( 'site_url', array( $this, '_fake_subfolder_install' ) );
    6464
    65         $_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/subfolder/test.php?id=123' );
     65        $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/subfolder/test.php?id=123' );
    6666        $_SERVER['REQUEST_URI']       = addslashes( '/subfolder/test.php?id=123' );
    6767        $this->assertFalse( wp_get_referer() );
     
    7676        add_filter( 'site_url', array( $this, '_fake_subfolder_install' ) );
    7777
    78         $_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/subfolder/another.php?id=123' );
     78        $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/subfolder/another.php?id=123' );
    7979        $_SERVER['REQUEST_URI']       = addslashes( '/subfolder/test.php?id=123' );
    80         $this->assertSame( 'http://example.org/subfolder/another.php?id=123', wp_get_referer() );
     80        $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/subfolder/another.php?id=123', wp_get_referer() );
    8181
    8282        remove_filter( 'site_url', array( $this, '_fake_subfolder_install' ) );
     
    9090
    9191    public function test_same_url() {
    92         $_SERVER['HTTP_REFERER'] = addslashes( 'http://example.org/test.php?id=123' );
     92        $_SERVER['HTTP_REFERER'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?id=123' );
    9393        $_SERVER['REQUEST_URI']  = addslashes( '/test.php?id=123' );
    9494        $this->assertFalse( wp_get_referer() );
     
    9696
    9797    public function test_different_resource() {
    98         $_SERVER['HTTP_REFERER'] = addslashes( 'http://example.org/another.php?id=123' );
     98        $_SERVER['HTTP_REFERER'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123' );
    9999        $_SERVER['REQUEST_URI']  = addslashes( '/test.php?id=123' );
    100         $this->assertSame( 'http://example.org/another.php?id=123', wp_get_referer() );
     100        $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123', wp_get_referer() );
    101101    }
    102102
     
    106106     */
    107107    public function test_different_server() {
    108         $_SERVER['HTTP_REFERER'] = addslashes( 'http://another.example.org/test.php?id=123' );
     108        $_SERVER['HTTP_REFERER'] = addslashes( 'http://another.' . WP_TESTS_DOMAIN . '/test.php?id=123' );
    109109        $_SERVER['REQUEST_URI']  = addslashes( '/test.php?id=123' );
    110110        $this->assertFalse( wp_get_referer() );
     
    117117    public function test_different_server_allowed_redirect_host() {
    118118        add_filter( 'allowed_redirect_hosts', array( $this, 'filter_allowed_redirect_hosts' ) );
    119         $_SERVER['HTTP_REFERER'] = addslashes( 'http://another.example.org/test.php?id=123' );
     119        $_SERVER['HTTP_REFERER'] = addslashes( 'http://another.' . WP_TESTS_DOMAIN . '/test.php?id=123' );
    120120        $_SERVER['REQUEST_URI']  = addslashes( '/test.php?id=123' );
    121         $this->assertSame( 'http://another.example.org/test.php?id=123', wp_get_referer() );
     121        $this->assertSame( 'http://another.' . WP_TESTS_DOMAIN . '/test.php?id=123', wp_get_referer() );
    122122        remove_filter( 'allowed_redirect_hosts', array( $this, 'filter_allowed_redirect_hosts' ) );
    123123    }
Note: See TracChangeset for help on using the changeset viewer.