Make WordPress Core


Ignore:
Timestamp:
10/03/2015 05:14:12 PM (11 years ago)
Author:
DrewAPicture
Message:

Tests: Introduce WP_UnitTestCase::reset_permalinks(), an attempt to DRY up logic for resetting and restoring default permalinks on setUp() and tearDown().

See #33968.

File:
1 edited

Legend:

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

    r34687 r34802  
    1515        function setUp() {
    1616                parent::setUp();
    17 
    18                 global $wp_rewrite;
    19                 $this->permalink_structure = get_option( 'permalink_structure' );
    20                 $wp_rewrite->set_permalink_structure( '' );
    21                 $wp_rewrite->flush_rules();
    2217
    2318                $this->author_id = $this->factory->user->create( array(
     
    4338
    4439        function tearDown() {
    45                 global $wp_rewrite;
    46                 $wp_rewrite->set_permalink_structure( $this->permalink_structure );
    47                 $wp_rewrite->flush_rules();
    48 
    4940                wp_reset_postdata();
    5041                parent::tearDown();
Note: See TracChangeset for help on using the changeset viewer.