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