From: X! Date: Sun, 2 Jan 2011 06:09:58 +0000 (+0000) Subject: Add API purge test (mainly as proof of concept for how API tests should be written) X-Git-Tag: 1.31.0-rc.0~32889 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=cbca0769b749b66a3c0333d4cb21741b488f031f;p=lhc%2Fweb%2Fwiklou.git Add API purge test (mainly as proof of concept for how API tests should be written) --- diff --git a/tests/phpunit/includes/api/ApiPurgeTest.php b/tests/phpunit/includes/api/ApiPurgeTest.php new file mode 100644 index 0000000000..8db882033f --- /dev/null +++ b/tests/phpunit/includes/api/ApiPurgeTest.php @@ -0,0 +1,38 @@ +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 ) ); + + $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'] ); + + } + +}