From bb2ddebec948f5a0a7a0fe18f287923a1395d051 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 20 Mar 2015 12:25:27 +0000 Subject: [PATCH] Enforce non-pretty permalinks in RSS2 tests. Previously, the tests were using '/feed/' in their `go_to()` statements, but testing nodes for URLs like '?p='. This mismatch created unpredictable results when the run in certain sequences with other groups of unit tests. See #31705. git-svn-id: https://develop.svn.wordpress.org/trunk@31846 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/feed/rss2.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/tests/feed/rss2.php b/tests/phpunit/tests/feed/rss2.php index 312af3fe99..56879588a6 100644 --- a/tests/phpunit/tests/feed/rss2.php +++ b/tests/phpunit/tests/feed/rss2.php @@ -9,8 +9,14 @@ * @group feed */ class Tests_Feed_RSS2 extends WP_UnitTestCase { + private $permalink_structure = ''; + + public function setUp() { + global $wp_rewrite; + $this->permalink_structure = get_option( 'permalink_structure' ); + $wp_rewrite->set_permalink_structure( '' ); + $wp_rewrite->flush_rules(); - function setUp() { parent::setUp(); $u = $this->factory->user->create(); @@ -24,6 +30,12 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase { update_option('use_smilies', false); } + public function tearDown() { + global $wp_rewrite; + $wp_rewrite->set_permalink_structure( $this->permalink_structure ); + $wp_rewrite->flush_rules(); + } + function do_rss2() { ob_start(); // nasty hack @@ -39,7 +51,7 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase { } function test_rss() { - $this->go_to('/feed/'); + $this->go_to( '/?feed=rss2' ); $feed = $this->do_rss2(); $xml = xml_to_array($feed); @@ -59,7 +71,7 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase { } function test_channel() { - $this->go_to('/feed/'); + $this->go_to( '/?feed=rss2' ); $feed = $this->do_rss2(); $xml = xml_to_array($feed); @@ -85,7 +97,7 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase { * @ticket UT32 */ function test_items() { - $this->go_to('/feed/'); + $this->go_to( '/?feed=rss2' ); $feed = $this->do_rss2(); $xml = xml_to_array($feed);