Changeset 34708 for trunk/tests/phpunit/tests/rewrite.php
- Timestamp:
- 09/30/2015 01:10:03 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite.php
r34215 r34708 32 32 } 33 33 34 /** 35 * @ticket 16840 36 */ 37 public function test_add_rule() { 38 global $wp_rewrite; 39 40 $pattern = 'path/to/rewrite/([^/]+)/?$'; 41 $redirect = 'index.php?test_var1=$matches[1]&test_var2=1'; 42 43 $wp_rewrite->add_rule( $pattern, $redirect ); 44 45 $wp_rewrite->flush_rules(); 46 47 $rewrite_rules = $wp_rewrite->rewrite_rules(); 48 49 $this->assertSame( $redirect, $rewrite_rules[ $pattern ] ); 50 } 51 52 /** 53 * @ticket 16840 54 */ 55 public function test_add_rule_redirect_array() { 56 global $wp_rewrite; 57 58 $pattern = 'path/to/rewrite/([^/]+)/?$'; 59 $redirect = 'index.php?test_var1=$matches[1]&test_var2=1'; 60 61 $wp_rewrite->add_rule( $pattern, array( 62 'test_var1' => '$matches[1]', 63 'test_var2' => '1' 64 ) ); 65 66 $wp_rewrite->flush_rules(); 67 68 $rewrite_rules = $wp_rewrite->rewrite_rules(); 69 70 $this->assertSame( $redirect, $rewrite_rules[ $pattern ] ); 71 } 72 73 /** 74 * @ticket 16840 75 */ 76 public function test_add_rule_top() { 77 global $wp_rewrite; 78 79 $pattern = 'path/to/rewrite/([^/]+)/?$'; 80 $redirect = 'index.php?test_var1=$matches[1]&test_var2=1'; 81 82 $wp_rewrite->add_rule( $pattern, $redirect, 'top' ); 83 84 $wp_rewrite->flush_rules(); 85 86 $extra_rules_top = $wp_rewrite->extra_rules_top; 87 88 $this->assertContains( $redirect, $extra_rules_top[ $pattern ] ); 89 } 90 34 91 function test_url_to_postid() { 35 92
Note: See TracChangeset
for help on using the changeset viewer.