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