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.php

    r34697 r34810  
    44
    55    function setUp() {
    6         global $wp_rewrite;
    76        parent::setUp();
    87
    9         $wp_rewrite->init();
    10         $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    11 
    128        create_initial_taxonomies();
    13 
    14         $wp_rewrite->flush_rules();
     9        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    1510    }
    1611
Note: See TracChangeset for help on using the changeset viewer.