MediaWiki
REL1_22
|
00001 <?php 00002 00008 class ApiPurgeTest extends ApiTestCase { 00009 00010 protected function setUp() { 00011 parent::setUp(); 00012 $this->doLogin(); 00013 } 00014 00018 public function testPurgeMainPage() { 00019 if ( !Title::newFromText( 'UTPage' )->exists() ) { 00020 $this->markTestIncomplete( "The article [[UTPage]] does not exist" ); 00021 } 00022 00023 $somePage = mt_rand(); 00024 00025 $data = $this->doApiRequest( array( 00026 'action' => 'purge', 00027 'titles' => 'UTPage|' . $somePage . '|%5D' ) ); 00028 00029 $this->assertArrayHasKey( 'purge', $data[0], 00030 "Must receive a 'purge' result from API" ); 00031 00032 $this->assertEquals( 3, count( $data[0]['purge'] ), 00033 "Purge request for three articles should give back three results received: " . var_export( $data[0]['purge'], true ) ); 00034 00035 $pages = array( 'UTPage' => 'purged', $somePage => 'missing', '%5D' => 'invalid' ); 00036 foreach ( $data[0]['purge'] as $v ) { 00037 $this->assertArrayHasKey( $pages[$v['title']], $v ); 00038 } 00039 } 00040 }