MediaWiki  REL1_22
ApiParseTest.php
Go to the documentation of this file.
00001 <?php
00002 
00008 class ApiParseTest extends ApiTestCase {
00009 
00010     protected function setUp() {
00011         parent::setUp();
00012         $this->doLogin();
00013     }
00014 
00015     public function testParseNonexistentPage() {
00016         $somePage = mt_rand();
00017 
00018         try {
00019             $this->doApiRequest( array(
00020                 'action' => 'parse',
00021                 'page' => $somePage ) );
00022 
00023             $this->fail( "API did not return an error when parsing a nonexistent page" );
00024         } catch ( UsageException $ex ) {
00025             $this->assertEquals( 'missingtitle', $ex->getCodeString(),
00026                 "Parse request for nonexistent page must give 'missingtitle' error: " . var_export( $ex->getMessageArray(), true ) );
00027         }
00028     }
00029 }