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