Make WordPress Core


Ignore:
Timestamp:
10/03/2015 08:54:11 PM (9 years ago)
Author:
DrewAPicture
Message:

Tests: Permalink Structures Phase II: DRY up logic for setting permalink structures in test methods.

Renames reset_permalinks() to set_permalink_structure() (mimicking $wp_rewrite->set_permalink_structure()) and allows it to accept an optional permalink structure. In this way, we can double dip using it to both set and reset the permalink structure from anywhere.

Removes alot of duplicated code from tests.

See #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/verboseRewriteRules.php

    r33250 r34810  
    99class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
    1010    function setUp() {
    11         global $wp_rewrite;
    12 
    1311        parent::setUp();
    14        
    15         $wp_rewrite->init();
    16         $wp_rewrite->set_permalink_structure( '/%category%/%year%/%postname%/' );
    1712
    1813        create_initial_taxonomies();
    1914
    20         $wp_rewrite->flush_rules();
     15        $this->set_permalink_structure( '/%category%/%year%/%postname%/' );
    2116    }
    2217}
Note: See TracChangeset for help on using the changeset viewer.