Changeset 32708 for trunk/tests/phpunit/tests/rewrite.php
- Timestamp:
- 06/08/2015 01:28:44 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/rewrite.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite.php
r32293 r32708 7 7 */ 8 8 class Tests_Rewrite extends WP_UnitTestCase { 9 private $home_url; 9 10 10 11 function setUp() { … … 19 20 20 21 $wp_rewrite->flush_rules(); 22 23 $this->home_url = get_option( 'home' ); 21 24 } 22 25 … … 25 28 $wp_rewrite->init(); 26 29 30 update_option( 'home', $this->home_url ); 27 31 parent::tearDown(); 28 32 } … … 73 77 $this->assertEquals( 0, url_to_postid( '/example-page/example/' ) ); 74 78 $this->assertEquals( 0, url_to_postid( '/example-page/ex/' ) ); 79 } 80 81 /** 82 * @ticket 30438 83 */ 84 function test_parse_request_home_path() { 85 $home_url = home_url( '/path/' ); 86 update_option( 'home', $home_url ); 87 88 $this->go_to( $home_url ); 89 $this->assertEquals( array(), $GLOBALS['wp']->query_vars ); 90 91 $this->go_to( $home_url . 'page' ); 92 $this->assertEquals( array( 'page' => '', 'pagename' => 'page' ), $GLOBALS['wp']->query_vars ); 93 } 94 95 /** 96 * @ticket 30438 97 */ 98 function test_parse_request_home_path_with_regex_character() { 99 $home_url = home_url( '/ma.ch/' ); 100 $not_a_home_url = home_url( '/match/' ); 101 update_option( 'home', $home_url ); 102 103 $this->go_to( $home_url ); 104 $this->assertEquals( array(), $GLOBALS['wp']->query_vars ); 105 106 $this->go_to( $home_url . 'page' ); 107 $this->assertEquals( array( 'page' => '', 'pagename' => 'page' ), $GLOBALS['wp']->query_vars ); 108 109 $this->go_to( $not_a_home_url . 'page' ); 110 $this->assertNotEquals( array( 'page' => '', 'pagename' => 'page' ), $GLOBALS['wp']->query_vars ); 111 $this->assertEquals( array( 'page' => '', 'pagename' => 'match/page' ), $GLOBALS['wp']->query_vars ); 75 112 } 76 113
Note: See TracChangeset
for help on using the changeset viewer.