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

    r31754 r34810  
    2323        update_option( 'posts_per_page', 5 );
    2424
    25         global $wp_rewrite;
    26 
    27         $wp_rewrite->init();
    28         $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    29 
    3025        create_initial_taxonomies();
    3126
    32         $wp_rewrite->flush_rules();
     27        $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    3328    }
    3429
Note: See TracChangeset for help on using the changeset viewer.