8 class ApiPurgeTest
extends ApiTestCase
{
10 protected function setUp() {
18 function testPurgeMainPage() {
19 if ( !Title
::newFromText( 'UTPage' )->exists() ) {
20 $this->markTestIncomplete( "The article [[UTPage]] does not exist" );
23 $somePage = mt_rand();
25 $data = $this->doApiRequest( array(
27 'titles' => 'UTPage|' . $somePage . '|%5D' ) );
29 $this->assertArrayHasKey( 'purge', $data[0],
30 "Must receive a 'purge' result from API" );
32 $this->assertEquals( 3, count( $data[0]['purge'] ),
33 "Purge request for three articles should give back three results received: " . var_export( $data[0]['purge'], true ) );
35 $pages = array( 'UTPage' => 'purged', $somePage => 'missing', '%5D' => 'invalid' );
36 foreach ( $data[0]['purge'] as $v ) {
37 $this->assertArrayHasKey( $pages[$v['title']], $v );