From 82ee95eb921f2dcd4a9b3ec8e098aa46b067c71a Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 11 Dec 2011 21:49:05 +0000 Subject: [PATCH] Attempt to fix tests broken by r105828 Test wanted in a specific order, now just look up wanted array key from title row Untested as my phpunit tests seem to be b0rked locally :( --- tests/phpunit/includes/api/ApiPurgeTest.php | 26 +++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/tests/phpunit/includes/api/ApiPurgeTest.php b/tests/phpunit/includes/api/ApiPurgeTest.php index db1563e9a9..553cd26675 100644 --- a/tests/phpunit/includes/api/ApiPurgeTest.php +++ b/tests/phpunit/includes/api/ApiPurgeTest.php @@ -9,33 +9,25 @@ class ApiPurgeTest extends ApiTestCase { parent::setUp(); $this->doLogin(); } - + function testPurgeMainPage() { - if ( !Title::newFromText( 'UTPage' )->exists() ) { $this->markTestIncomplete( "The article [[UTPage]] does not exist" ); } - + $somePage = mt_rand(); $data = $this->doApiRequest( array( 'action' => 'purge', 'titles' => 'UTPage|' . $somePage . '|%5D' ) ); - + $this->assertArrayHasKey( 'purge', $data[0] ); - - $this->assertArrayHasKey( 0, $data[0]['purge'] ); - $this->assertArrayHasKey( 'purged', $data[0]['purge'][0] ); - $this->assertEquals( 'UTPage', $data[0]['purge'][0]['title'] ); - - $this->assertArrayHasKey( 1, $data[0]['purge'] ); - $this->assertArrayHasKey( 'missing', $data[0]['purge'][1] ); - $this->assertEquals( $somePage, $data[0]['purge'][1]['title'] ); - - $this->assertArrayHasKey( 2, $data[0]['purge'] ); - $this->assertArrayHasKey( 'invalid', $data[0]['purge'][2] ); - $this->assertEquals( '%5D', $data[0]['purge'][2]['title'] ); - + $this->assertEquals( 3, count( $data[0]['purge'] ) ); + + $pages = array( 'UTPage' => 'purged', $somePage => 'missing', '%5D' => 'invalid' ); + foreach( $data[0]['purge'] as $v ) { + $this->assertArrayHasKey( $pages[$v['title']], $v ); + } } } -- 2.20.1