Merge "Fix more UnitTests for databases that do not use integer timestamps"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiPurgeTest.php
1 <?php
2
3 /**
4 * @group API
5 * @group Database
6 * @group medium
7 */
8 class ApiPurgeTest extends ApiTestCase {
9
10 protected function setUp() {
11 parent::setUp();
12 $this->doLogin();
13 }
14
15 /**
16 * @group Broken
17 */
18 function testPurgeMainPage() {
19 if ( !Title::newFromText( 'UTPage' )->exists() ) {
20 $this->markTestIncomplete( "The article [[UTPage]] does not exist" );
21 }
22
23 $somePage = mt_rand();
24
25 $data = $this->doApiRequest( array(
26 'action' => 'purge',
27 'titles' => 'UTPage|' . $somePage . '|%5D' ) );
28
29 $this->assertArrayHasKey( 'purge', $data[0],
30 "Must receive a 'purge' result from API" );
31
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 ) );
34
35 $pages = array( 'UTPage' => 'purged', $somePage => 'missing', '%5D' => 'invalid' );
36 foreach ( $data[0]['purge'] as $v ) {
37 $this->assertArrayHasKey( $pages[$v['title']], $v );
38 }
39 }
40
41 }