blob: c323aa88352ea4a6c9a010d55e9438963c8ea37b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<?php
/**
* @group API
* @group Database
* @group medium
*
* @covers ApiPurge
*/
class ApiPurgeTest extends ApiTestCase {
public function testPurgePage() {
$this->getExistingTestPage( 'UTPage' );
$this->getNonexistingTestPage( 'UTPage-NotFound' );
list( $data ) = $this->doApiRequest( [
'action' => 'purge',
'titles' => 'UTPage|UTPage-NotFound|%5D'
] );
$resultByTitle = [];
foreach ( $data['purge'] as $entry ) {
$key = $entry['title'];
// Ignore localised or redundant field
unset( $entry['invalidreason'] );
unset( $entry['title'] );
$resultByTitle[$key] = $entry;
}
$this->assertEquals(
[
'UTPage' => [ 'purged' => true, 'ns' => 0 ],
'UTPage-NotFound' => [ 'missing' => true, 'ns' => 0 ],
'%5D' => [ 'invalid' => true ],
],
$resultByTitle,
'Result'
);
}
}
|