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
This commit is contained in:
Boone Gorges 2015-03-20 12:25:27 +00:00
parent 6de5ae56dd
commit bb2ddebec9
1 changed files with 16 additions and 4 deletions

View File

@ -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);