Built/Test Tools: Unify the way the permastructure is set when used in conjunction with re-registering the initial taxonomies. This ensure that rewrite rules for taxonomies are consistently available.

Fixes #35452


git-svn-id: https://develop.svn.wordpress.org/trunk@38654 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2016-09-26 17:01:48 +00:00
parent 6d05c7db0d
commit fa48bfa1d2
5 changed files with 6 additions and 21 deletions

View File

@ -30,13 +30,8 @@ class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
update_option( 'comments_per_page', 5 );
update_option( 'posts_per_page', 5 );
global $wp_rewrite;
$wp_rewrite->init();
$wp_rewrite->set_permalink_structure( $this->structure );
$this->set_permalink_structure( $this->structure );
create_initial_taxonomies();
$wp_rewrite->flush_rules();
}
/**

View File

@ -7,14 +7,10 @@
*/
class Tests_Canonical_HTTPS extends WP_Canonical_UnitTestCase {
function setUp() {
global $wp_rewrite;
parent::setUp();
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
create_initial_taxonomies();
$wp_rewrite->flush_rules();
$wp_rewrite->init();
$this->http = set_url_scheme( home_url( 'sample-page/' ), 'http' );
$this->https = set_url_scheme( home_url( 'sample-page/' ), 'https' );

View File

@ -5,8 +5,8 @@ class Tests_Query extends WP_UnitTestCase {
function setUp() {
parent::setUp();
create_initial_taxonomies();
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
create_initial_taxonomies();
}
/**

View File

@ -10,8 +10,7 @@ class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
function setUp() {
parent::setUp();
create_initial_taxonomies();
$this->set_permalink_structure( '/%category%/%year%/%postname%/' );
create_initial_taxonomies();
}
}

View File

@ -11,9 +11,8 @@ class Tests_Rewrite extends WP_UnitTestCase {
function setUp() {
parent::setUp();
create_initial_taxonomies();
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
create_initial_taxonomies();
$this->home_url = get_option( 'home' );
}
@ -348,8 +347,6 @@ class Tests_Rewrite extends WP_UnitTestCase {
$post_id = self::factory()->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );
$this->assertEquals( $post_id, url_to_postid( get_permalink( $post_id ) ) );
$this->set_permalink_structure();
}
/**
@ -385,15 +382,13 @@ class Tests_Rewrite extends WP_UnitTestCase {
$this->assertTrue( is_single() );
$this->assertFalse( is_404() );
$this->set_permalink_structure();
}
/**
* @ticket 29107
*/
public function test_flush_rules_does_not_delete_option() {
$this->set_permalink_structure();
$this->set_permalink_structure( '' );
$rewrite_rules = get_option( 'rewrite_rules' );
$this->assertSame( '', $rewrite_rules );