2012-10-16 15:42:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group API
|
|
|
|
|
* @group Database
|
2013-01-18 19:02:28 +00:00
|
|
|
* @group medium
|
2013-10-23 16:01:33 +00:00
|
|
|
*
|
|
|
|
|
* @covers ApiParse
|
2012-10-16 15:42:54 +00:00
|
|
|
*/
|
|
|
|
|
class ApiParseTest extends ApiTestCase {
|
|
|
|
|
|
|
|
|
|
protected function setUp() {
|
|
|
|
|
parent::setUp();
|
|
|
|
|
$this->doLogin();
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testParseNonexistentPage() {
|
2012-10-16 15:42:54 +00:00
|
|
|
$somePage = mt_rand();
|
|
|
|
|
|
|
|
|
|
try {
|
2013-04-26 07:48:46 +00:00
|
|
|
$this->doApiRequest( array(
|
2012-10-16 15:42:54 +00:00
|
|
|
'action' => 'parse',
|
|
|
|
|
'page' => $somePage ) );
|
|
|
|
|
|
|
|
|
|
$this->fail( "API did not return an error when parsing a nonexistent page" );
|
2013-02-14 11:56:23 +00:00
|
|
|
} catch ( UsageException $ex ) {
|
2012-10-16 15:42:54 +00:00
|
|
|
$this->assertEquals( 'missingtitle', $ex->getCodeString(),
|
|
|
|
|
"Parse request for nonexistent page must give 'missingtitle' error: " . var_export( $ex->getMessageArray(), true ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|