wiki.techinc.nl/tests/phpunit/includes/api/ApiParseTest.php
Brad Jorsch 252ae6268b (bug 43762) Mark slow unit test as @group medium
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
2013-01-18 14:07:49 -05:00

30 lines
653 B
PHP

<?php
/**
* @group API
* @group Database
* @group medium
*/
class ApiParseTest extends ApiTestCase {
protected function setUp() {
parent::setUp();
$this->doLogin();
}
function testParseNonexistentPage() {
$somePage = mt_rand();
try {
$data = $this->doApiRequest( array(
'action' => 'parse',
'page' => $somePage ) );
$this->fail( "API did not return an error when parsing a nonexistent page" );
} catch(UsageException $ex){
$this->assertEquals( 'missingtitle', $ex->getCodeString(),
"Parse request for nonexistent page must give 'missingtitle' error: " . var_export( $ex->getMessageArray(), true ) );
}
}
}