Changeset 34802 for trunk/tests/phpunit/includes/testcase.php
- Timestamp:
- 10/03/2015 05:14:12 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r34720 r34802 16 16 17 17 protected $db_version; 18 19 public static $default_permalink_structure; 18 20 19 21 /** … … 71 73 add_filter( 'pre_option_db_version', array( $this, 'db_version' ) ); 72 74 } 75 76 self::$default_permalink_structure = get_option( 'permalink_structure' ); 77 78 $this->reset_permalinks(); 73 79 } 74 80 … … 100 106 $this->_restore_hooks(); 101 107 wp_set_current_user( 0 ); 108 109 $this->reset_permalinks( $restore = true ); 102 110 } 103 111 … … 646 654 return $this->db_version; 647 655 } 656 657 /** 658 * Utility method that resets permalinks and flushes rewrites. 659 * 660 * Collects the current permalink structure and stores it in a class property for use 661 * by sub-classes. 662 * 663 * @since 4.4.0 664 * 665 * @global WP_Rewrite $wp_rewrite 666 * 667 * @param bool $restore_default Optional. Whether to restore the default permalink structure. 668 * Default false. 669 */ 670 public function reset_permalinks( $restore_default = false ) { 671 global $wp_rewrite; 672 673 if ( ! $restore_default ) { 674 $wp_rewrite->init(); 675 $wp_rewrite->set_permalink_structure( '' ); 676 } else { 677 $wp_rewrite->set_permalink_structure( self::$default_permalink_structure ); 678 } 679 680 $wp_rewrite->flush_rules(); 681 } 648 682 }
Note: See TracChangeset
for help on using the changeset viewer.