All tests based on APITestCase can be slow. I've also seen more than one Jenkins failure due to GlobalTest::testMerge timing out. Also, added a meta-test on APITestCase to make sure that all its subclasses are marked with @group medium or @group large, to prevent new tests from re-causing the bug. Change-Id: I48630736a3d06574876fd1fa3d90899cfbc48012
41 lines
975 B
PHP
41 lines
975 B
PHP
<?php
|
|
|
|
/**
|
|
* @group API
|
|
* @group Database
|
|
* @group medium
|
|
*/
|
|
class ApiPurgeTest extends ApiTestCase {
|
|
|
|
protected function setUp() {
|
|
parent::setUp();
|
|
$this->doLogin();
|
|
}
|
|
|
|
/**
|
|
* @group Broken
|
|
*/
|
|
function testPurgeMainPage() {
|
|
if ( !Title::newFromText( 'UTPage' )->exists() ) {
|
|
$this->markTestIncomplete( "The article [[UTPage]] does not exist" );
|
|
}
|
|
|
|
$somePage = mt_rand();
|
|
|
|
$data = $this->doApiRequest( array(
|
|
'action' => 'purge',
|
|
'titles' => 'UTPage|' . $somePage . '|%5D' ) );
|
|
|
|
$this->assertArrayHasKey( 'purge', $data[0],
|
|
"Must receive a 'purge' result from API" );
|
|
|
|
$this->assertEquals( 3, count( $data[0]['purge'] ),
|
|
"Purge request for three articles should give back three results received: " . var_export( $data[0]['purge'], true ) );
|
|
|
|
$pages = array( 'UTPage' => 'purged', $somePage => 'missing', '%5D' => 'invalid' );
|
|
foreach( $data[0]['purge'] as $v ) {
|
|
$this->assertArrayHasKey( $pages[$v['title']], $v );
|
|
}
|
|
}
|
|
|
|
}
|