diff --git a/tests/phpunit/includes/testcase-canonical.php b/tests/phpunit/includes/testcase-canonical.php index 33dbb3d9f438b..9a62c21c4827e 100644 --- a/tests/phpunit/includes/testcase-canonical.php +++ b/tests/phpunit/includes/testcase-canonical.php @@ -31,7 +31,8 @@ public function set_up() { update_option( 'posts_per_page', 5 ); $this->set_permalink_structure( $this->structure ); - create_initial_taxonomies(); + $this->reset_taxonomies(); + flush_rewrite_rules(); } /** diff --git a/tests/phpunit/tests/query/stickies.php b/tests/phpunit/tests/query/stickies.php index 81a991c6d729d..4994b0ff1a600 100644 --- a/tests/phpunit/tests/query/stickies.php +++ b/tests/phpunit/tests/query/stickies.php @@ -8,8 +8,12 @@ */ class Tests_Query_Stickies extends WP_UnitTestCase { public static $posts = array(); + private static $original_sticky_posts; public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { + self::$original_sticky_posts = get_option( 'sticky_posts' ); + update_option( 'sticky_posts', array() ); + // Set post times to get a reliable order. $now = time(); for ( $i = 0; $i <= 22; $i++ ) { @@ -26,6 +30,10 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { stick_post( self::$posts[8] ); } + public static function wpTearDownAfterClass() { + update_option( 'sticky_posts', self::$original_sticky_posts ); + } + public function test_stickies_should_be_ignored_when_is_home_is_false() { $q = new WP_Query( array( diff --git a/tests/phpunit/tests/query/thePost.php b/tests/phpunit/tests/query/thePost.php index 6032a01dbeb1b..70e96541838df 100644 --- a/tests/phpunit/tests/query/thePost.php +++ b/tests/phpunit/tests/query/thePost.php @@ -110,7 +110,7 @@ function ( $fields, $query ) { 'fields' => 'custom', 'post_type' => 'page', 'post__in' => self::$page_child_ids, - 'orderby' => 'id', + 'orderby' => 'ID', 'order' => 'ASC', ) );