WordPress.org

Make WordPress Core

Changeset 34807


Ignore:
Timestamp:
10/03/2015 07:26:24 PM (4 years ago)
Author:
DrewAPicture
Message:

Tests: Last try: It's redundant to reset permalinks on tearDown() if we're already doing it on every setUp().

Removes the restoration logic, which leveraged a static property initialized with get_option().

See #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r34803 r34807  
    1616
    1717    protected $db_version;
    18 
    19     public static $default_permalink_structure;
    2018
    2119    /**
     
    4240        $this->factory = new WP_UnitTest_Factory;
    4341        $this->clean_up_global_scope();
    44 
    45         self::$default_permalink_structure = get_option( 'permalink_structure' );
    4642
    4743        /*
     
    105101        $this->_restore_hooks();
    106102        wp_set_current_user( 0 );
    107 
    108         $this->reset_permalinks( $restore = true );
    109103    }
    110104
     
    657651     * Utility method that resets permalinks and flushes rewrites.
    658652     *
    659      * Collects the current permalink structure and stores it in a class property for use
    660      * by sub-classes.
    661      *
    662653     * @since 4.4.0
    663654     *
    664655     * @global WP_Rewrite $wp_rewrite
    665      *
    666      * @param bool $restore_default Optional. Whether to restore the default permalink structure.
    667      *                              Default false.
    668      */
    669     public function reset_permalinks( $restore_default = false ) {
     656     */
     657    public function reset_permalinks() {
    670658        global $wp_rewrite;
    671659
    672         if ( ! $restore_default ) {
    673             $wp_rewrite->init();
    674             $wp_rewrite->set_permalink_structure( '' );
    675         } else {
    676             $wp_rewrite->set_permalink_structure( self::$default_permalink_structure );
    677         }
    678 
     660        $wp_rewrite->init();
     661        $wp_rewrite->set_permalink_structure( '' );
    679662        $wp_rewrite->flush_rules();
    680663    }
Note: See TracChangeset for help on using the changeset viewer.