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 {
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->doApiRequest( [
|
2012-10-16 15:42:54 +00:00
|
|
|
'action' => 'parse',
|
2016-02-17 09:09:32 +00:00
|
|
|
'page' => $somePage ] );
|
2012-10-16 15:42:54 +00:00
|
|
|
|
|
|
|
|
$this->fail( "API did not return an error when parsing a nonexistent page" );
|
2013-02-14 11:56:23 +00:00
|
|
|
} catch ( UsageException $ex ) {
|
2014-04-24 15:05:10 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'missingtitle',
|
|
|
|
|
$ex->getCodeString(),
|
|
|
|
|
"Parse request for nonexistent page must give 'missingtitle' error: "
|
|
|
|
|
. var_export( $ex->getMessageArray(), true )
|
|
|
|
|
);
|
2012-10-16 15:42:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|