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/post/wpUniquePostSlug.php

    r33262 r34802  
    182182        $found = wp_unique_post_slug( '2015', $p, 'publish', 'post', 0 );
    183183        $this->assertEquals( '2015-2', $found );
    184 
    185         $wp_rewrite->set_permalink_structure( '' );
    186         flush_rewrite_rules();
    187184    }
    188185
     
    204201        $found = wp_unique_post_slug( '2015', $p, 'publish', 'post', 0 );
    205202        $this->assertEquals( '2015-2', $found );
    206 
    207         $wp_rewrite->set_permalink_structure( '' );
    208         flush_rewrite_rules();
    209203    }
    210204
     
    225219        $found = wp_unique_post_slug( '2015', $p, 'publish', 'post', 0 );
    226220        $this->assertEquals( '2015', $found );
    227 
    228         $wp_rewrite->set_permalink_structure( '' );
    229         flush_rewrite_rules();
    230221    }
    231222
     
    246237        $found = wp_unique_post_slug( '11', $p, 'publish', 'post', 0 );
    247238        $this->assertEquals( '11-2', $found );
    248 
    249         $wp_rewrite->set_permalink_structure( '' );
    250         flush_rewrite_rules();
    251239    }
    252240
     
    267255        $found = wp_unique_post_slug( '11', $p, 'publish', 'post', 0 );
    268256        $this->assertEquals( '11', $found );
    269 
    270         $wp_rewrite->set_permalink_structure( '' );
    271         flush_rewrite_rules();
    272257    }
    273258
     
    288273        $found = wp_unique_post_slug( '13', $p, 'publish', 'post', 0 );
    289274        $this->assertEquals( '13', $found );
    290 
    291         $wp_rewrite->set_permalink_structure( '' );
    292         flush_rewrite_rules();
    293275    }
    294276
     
    309291        $found = wp_unique_post_slug( '30', $p, 'publish', 'post', 0 );
    310292        $this->assertEquals( '30-2', $found );
    311 
    312         $wp_rewrite->set_permalink_structure( '' );
    313         flush_rewrite_rules();
    314293    }
    315294
     
    330309        $found = wp_unique_post_slug( '30', $p, 'publish', 'post', 0 );
    331310        $this->assertEquals( '30', $found );
    332 
    333         $wp_rewrite->set_permalink_structure( '' );
    334         flush_rewrite_rules();
    335311    }
    336312
     
    351327        $found = wp_unique_post_slug( '32', $p, 'publish', 'post', 0 );
    352328        $this->assertEquals( '32', $found );
    353 
    354         $wp_rewrite->set_permalink_structure( '' );
    355         flush_rewrite_rules();
    356329    }
    357330}
Note: See TracChangeset for help on using the changeset viewer.