MediaWiki  REL1_22
ApiQueryRevisionsTest.php
Go to the documentation of this file.
00001 <?php
00002 
00008 class ApiQueryRevisionsTest extends ApiTestCase {
00009 
00013     public function testContentComesWithContentModelAndFormat() {
00014         $pageName = 'Help:' . __METHOD__;
00015         $title = Title::newFromText( $pageName );
00016         $page = WikiPage::factory( $title );
00017         $page->doEdit( 'Some text', 'inserting content' );
00018 
00019         $apiResult = $this->doApiRequest( array(
00020             'action' => 'query',
00021             'prop' => 'revisions',
00022             'titles' => $pageName,
00023             'rvprop' => 'content',
00024         ) );
00025         $this->assertArrayHasKey( 'query', $apiResult[0] );
00026         $this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
00027         foreach ( $apiResult[0]['query']['pages'] as $page ) {
00028             $this->assertArrayHasKey( 'revisions', $page );
00029             foreach ( $page['revisions'] as $revision ) {
00030                 $this->assertArrayHasKey( 'contentformat', $revision,
00031                     'contentformat should be included when asking content so client knows how to interpret it'
00032                 );
00033                 $this->assertArrayHasKey( 'contentmodel', $revision,
00034                     'contentmodel should be included when asking content so client knows how to interpret it'
00035                 );
00036             }
00037         }
00038     }
00039 }