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.


git-svn-id: https://develop.svn.wordpress.org/trunk@34810 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes
2015-10-03 20:54:11 +00:00
parent eebe549408
commit 0ea2acb720
15 changed files with 82 additions and 264 deletions

View File

@@ -3,15 +3,10 @@
class Tests_Query extends WP_UnitTestCase {
function setUp() {
global $wp_rewrite;
parent::setUp();
$wp_rewrite->init();
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
create_initial_taxonomies();
$wp_rewrite->flush_rules();
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
}
/**