Make WordPress Core


Ignore:
Timestamp:
10/03/2015 05:14:12 PM (10 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/feed/rss2.php

    r34092 r34802  
    1010 */
    1111class Tests_Feed_RSS2 extends WP_UnitTestCase {
    12     private $permalink_structure = '';
    13 
    1412    static $user;
    1513    static $posts;
     
    4139
    4240    public function setUp() {
    43         global $wp_rewrite;
    44         $this->permalink_structure = get_option( 'permalink_structure' );
    45         $wp_rewrite->set_permalink_structure( '' );
    46         $wp_rewrite->flush_rules();
    47 
    4841        parent::setUp();
    4942
     
    5245        // this seems to break something
    5346        update_option('use_smilies', false);
    54     }
    55 
    56     public function tearDown() {
    57         global $wp_rewrite;
    58         $wp_rewrite->set_permalink_structure( $this->permalink_structure );
    59         $wp_rewrite->flush_rules();
    6047    }
    6148
Note: See TracChangeset for help on using the changeset viewer.