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