Move DatabaseDomain to Rdbms namespace
[mediawiki.git] / tests / phpunit / includes / api / ApiPurgeTest.php
blob9e1d3a189b27150ed0d650915fe98b5945e8a057
1 <?php
3 /**
4 * @group API
5 * @group Database
6 * @group medium
8 * @covers ApiPurge
9 */
10 class ApiPurgeTest extends ApiTestCase {
12 protected function setUp() {
13 parent::setUp();
14 $this->doLogin();
17 /**
18 * @group Broken
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( [
28 'action' => 'purge',
29 'titles' => 'UTPage|' . $somePage . '|%5D' ] );
31 $this->assertArrayHasKey( 'purge', $data[0],
32 "Must receive a 'purge' result from API" );
34 $this->assertEquals(
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 );