WordPress.org

Make WordPress Core

Changeset 34678


Ignore:
Timestamp:
09/29/2015 02:18:55 AM (4 years ago)
Author:
DrewAPicture
Message:

Tests: Flush rewrite rules between tests in an attempt to avoid permalinks pollution in Tests_Author_Template.

See #30355.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/template/author.php

    r34677 r34678  
    77 */
    88class Tests_Author_Template extends WP_UnitTestCase {
     9    private $permalink_structure;
     10
     11    public function setUp() {
     12        parent::setUp();
     13
     14        global $wp_rewrite;
     15        $this->permalink_structure = get_option( 'permalink_structure' );
     16        $wp_rewrite->set_permalink_structure( '' );
     17        $wp_rewrite->flush_rules();
     18
     19    }
     20
     21    public function tearDown() {
     22        global $wp_rewrite;
     23        $wp_rewrite->set_permalink_structure( $this->permalink_structure );
     24        $wp_rewrite->flush_rules();
     25
     26        parent::tearDown();
     27    }
    928
    1029    /**
     
    5473        $this->assertContains( '>Foo</a>', $link );
    5574
    56         // Cleanup.
    57         $wp_rewrite->set_permalink_structure( '' );
    5875        unset( $GLOBALS['authordata'] );
    5976    }
Note: See TracChangeset for help on using the changeset viewer.