Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
40 lines
832 B
PHP
40 lines
832 B
PHP
<?php
|
|
|
|
/**
|
|
* @group API
|
|
* @group Database
|
|
* @group medium
|
|
*
|
|
* @covers ApiPurge
|
|
*/
|
|
class ApiPurgeTest extends ApiTestCase {
|
|
|
|
public function testPurgePage() {
|
|
$this->getExistingTestPage( 'UTPage' );
|
|
$this->getNonexistingTestPage( 'UTPage-NotFound' );
|
|
|
|
[ $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'
|
|
);
|
|
}
|
|
}
|