Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fa48bfa

Browse filesBrowse files
committed
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
1 parent 6d05c7d commit fa48bfa
Copy full SHA for fa48bfa

File tree

Expand file treeCollapse file tree

5 files changed

+6
-21
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+6
-21
lines changed
Open diff view settings
Collapse file

‎tests/phpunit/includes/testcase-canonical.php‎

Copy file name to clipboardExpand all lines: tests/phpunit/includes/testcase-canonical.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,8 @@ public function setUp() {
3030
update_option( 'comments_per_page', 5 );
3131
update_option( 'posts_per_page', 5 );
3232

33-
global $wp_rewrite;
34-
$wp_rewrite->init();
35-
$wp_rewrite->set_permalink_structure( $this->structure );
36-
33+
$this->set_permalink_structure( $this->structure );
3734
create_initial_taxonomies();
38-
39-
$wp_rewrite->flush_rules();
4035
}
4136

4237
/**
Collapse file

‎tests/phpunit/tests/canonical/https.php‎

Copy file name to clipboardExpand all lines: tests/phpunit/tests/canonical/https.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77
*/
88
class Tests_Canonical_HTTPS extends WP_Canonical_UnitTestCase {
99
function setUp() {
10-
global $wp_rewrite;
11-
1210
parent::setUp();
1311

14-
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
12+
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
1513
create_initial_taxonomies();
16-
$wp_rewrite->flush_rules();
17-
$wp_rewrite->init();
1814

1915
$this->http = set_url_scheme( home_url( 'sample-page/' ), 'http' );
2016
$this->https = set_url_scheme( home_url( 'sample-page/' ), 'https' );
Collapse file

‎tests/phpunit/tests/query.php‎

Copy file name to clipboardExpand all lines: tests/phpunit/tests/query.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ class Tests_Query extends WP_UnitTestCase {
55
function setUp() {
66
parent::setUp();
77

8-
create_initial_taxonomies();
98
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
9+
create_initial_taxonomies();
1010
}
1111

1212
/**
Collapse file

‎tests/phpunit/tests/query/verboseRewriteRules.php‎

Copy file name to clipboardExpand all lines: tests/phpunit/tests/query/verboseRewriteRules.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
1010
function setUp() {
1111
parent::setUp();
1212

13-
create_initial_taxonomies();
14-
1513
$this->set_permalink_structure( '/%category%/%year%/%postname%/' );
14+
create_initial_taxonomies();
1615
}
1716
}
Collapse file

‎tests/phpunit/tests/rewrite.php‎

Copy file name to clipboardExpand all lines: tests/phpunit/tests/rewrite.php
+2-7Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ class Tests_Rewrite extends WP_UnitTestCase {
1111
function setUp() {
1212
parent::setUp();
1313

14-
create_initial_taxonomies();
15-
1614
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
15+
create_initial_taxonomies();
1716

1817
$this->home_url = get_option( 'home' );
1918
}
@@ -348,8 +347,6 @@ function test_url_to_postid_with_post_slug_that_clashes_with_a_trashed_page() {
348347
$post_id = self::factory()->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );
349348

350349
$this->assertEquals( $post_id, url_to_postid( get_permalink( $post_id ) ) );
351-
352-
$this->set_permalink_structure();
353350
}
354351

355352
/**
@@ -385,15 +382,13 @@ function test_parse_request_with_post_slug_that_clashes_with_a_trashed_page() {
385382

386383
$this->assertTrue( is_single() );
387384
$this->assertFalse( is_404() );
388-
389-
$this->set_permalink_structure();
390385
}
391386

392387
/**
393388
* @ticket 29107
394389
*/
395390
public function test_flush_rules_does_not_delete_option() {
396-
$this->set_permalink_structure();
391+
$this->set_permalink_structure( '' );
397392

398393
$rewrite_rules = get_option( 'rewrite_rules' );
399394
$this->assertSame( '', $rewrite_rules );

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.