MediaWiki REL1_31
ApiPurgeTest.php
Go to the documentation of this file.
1<?php
2
11
15 public function testPurgeMainPage() {
16 if ( !Title::newFromText( 'UTPage' )->exists() ) {
17 $this->markTestIncomplete( "The article [[UTPage]] does not exist" );
18 }
19
20 $somePage = mt_rand();
21
22 $data = $this->doApiRequest( [
23 'action' => 'purge',
24 'titles' => 'UTPage|' . $somePage . '|%5D' ] );
25
26 $this->assertArrayHasKey( 'purge', $data[0],
27 "Must receive a 'purge' result from API" );
28
29 $this->assertEquals(
30 3,
31 count( $data[0]['purge'] ),
32 "Purge request for three articles should give back three results received: "
33 . var_export( $data[0]['purge'], true ) );
34
35 $pages = [ 'UTPage' => 'purged', $somePage => 'missing', '%5D' => 'invalid' ];
36 foreach ( $data[0]['purge'] as $v ) {
37 $this->assertArrayHasKey( $pages[$v['title']], $v );
38 }
39 }
40}
API Database medium.
testPurgeMainPage()
Broken.
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
Does the API request and returns the result.