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

    r34802 r34810  
    2020        add_filter( 'old_slug_redirect_url', array( $this, 'filter_old_slug_redirect_url' ), 10, 1 );
    2121
    22         global $wp_rewrite;
     22        $this->set_permalink_structure( '/%postname%/' );
    2323
    24         $wp_rewrite->init();
    25         $wp_rewrite->set_permalink_structure( '/%postname%/' );
    2624        add_rewrite_endpoint( 'custom-endpoint', EP_PERMALINK );
    2725        add_rewrite_endpoint( 'second-endpoint', EP_PERMALINK, 'custom' );
    28         $wp_rewrite->flush_rules();
     26
     27        flush_rewrite_rules();
    2928    }
    3029
Note: See TracChangeset for help on using the changeset viewer.