WordPress.org

Make WordPress Core

Changeset 36717


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

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

See #34000

Location:
trunk/tests/phpunit/tests
Files:
3 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    }
  • trunk/tests/phpunit/tests/rewrite/numericSlugs.php

    r35242 r36717  
    3838            array(
    3939                'ID'   => '2015',
    40                 'guid' => 'http://example.org/?p=2015'
     40                'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015'
    4141            ),
    4242            array( 'ID' => $id )
     
    6666            array(
    6767                'ID'   => '2015',
    68                 'guid' => 'http://example.org/?p=2015'
     68                'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015'
    6969            ),
    7070            array( 'ID' => $id )
  • trunk/tests/phpunit/tests/upload.php

    r36565 r36717  
    8383
    8484    function test_upload_path_absolute() {
    85         update_option( 'upload_url_path', 'http://example.org/asdf' );
     85        update_option( 'upload_url_path', 'http://' . WP_TESTS_DOMAIN . '/asdf' );
    8686
    8787        // Use `_wp_upload_dir()` directly to bypass caching and work with the changed options.
     
    9090        $subdir = gmstrftime('/%Y/%m');
    9191
    92         $this->assertEquals( 'http://example.org/asdf' . $subdir, $info['url'] );
     92        $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/asdf' . $subdir, $info['url'] );
    9393        $this->assertEquals( ABSPATH . 'wp-content/uploads' . $subdir, $info['path'] );
    9494        $this->assertEquals( $subdir, $info['subdir'] );
Note: See TracChangeset for help on using the changeset viewer.