Make WordPress Core

Ticket #30438: unit-test.diff

File unit-test.diff, 1.1 KB (added by akirk, 10 years ago)
  • tests/phpunit/tests/rewrite.php

     
    7373                $this->assertEquals( 0, url_to_postid( '/example-page/ex/' ) );
    7474        }
    7575
     76        function test_parse_request_home_path() {
     77                $home_url = home_url( '/path/' );
     78                update_option( 'home', $home_url );
     79
     80                $this->go_to( $home_url );
     81                $this->assertEquals( array(), $GLOBALS['wp']->query_vars );
     82
     83                $this->go_to( $home_url . 'page');
     84                $this->assertEquals( array('page' => '', 'pagename' => 'page'), $GLOBALS['wp']->query_vars );
     85        }
     86
     87        function test_parse_request_home_path_with_regexchar() {
     88                $home_url = home_url( '/pa+th/' );
     89                update_option( 'home', $home_url );
     90
     91                $this->go_to( $home_url );
     92                $this->assertEquals( array(), $GLOBALS['wp']->query_vars );
     93
     94                $this->go_to( $home_url . 'page');
     95                $this->assertEquals( array('page' => '', 'pagename' => 'page'), $GLOBALS['wp']->query_vars );
     96        }
     97
    7698        function test_url_to_postid_dupe_path() {
    7799                update_option( 'home', home_url('/example/') );
    78100