MediaWiki
REL1_31
ApiPurgeTest.php
Go to the documentation of this file.
1
<?php
2
10
class
ApiPurgeTest
extends
ApiTestCase
{
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
}
ApiPurgeTest
API Database medium.
Definition
ApiPurgeTest.php:10
ApiPurgeTest\testPurgeMainPage
testPurgeMainPage()
Broken.
Definition
ApiPurgeTest.php:15
ApiTestCase
Definition
ApiTestCase.php:5
ApiTestCase\doApiRequest
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
Does the API request and returns the result.
Definition
ApiTestCase.php:100
tests
phpunit
includes
api
ApiPurgeTest.php
Generated on Mon Nov 25 2024 15:36:14 for MediaWiki by
1.10.0