From: Sam Reed Date: Sun, 11 Dec 2011 21:49:05 +0000 (+0000) Subject: Attempt to fix tests broken by r105828 X-Git-Tag: 1.31.0-rc.0~26066 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=82ee95eb921f2dcd4a9b3ec8e098aa46b067c71a;p=lhc%2Fweb%2Fwiklou.git 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 :( --- 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 ); + } } }