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

    r34708 r34810  
    1010
    1111    function setUp() {
    12         global $wp_rewrite;
    1312        parent::setUp();
    1413
    15         // Need rewrite rules in place to use url_to_postid
    16         $wp_rewrite->init();
    17         $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    18 
    1914        create_initial_taxonomies();
    2015
    21         $wp_rewrite->flush_rules();
     16        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    2217
    2318        $this->home_url = get_option( 'home' );
Note: See TracChangeset for help on using the changeset viewer.