8 class ApiQueryRevisionsTest
extends ApiTestCase
{
13 function testContentComesWithContentModelAndFormat() {
14 $pageName = 'Help:' . __METHOD__
;
15 $title = Title
::newFromText( $pageName );
16 $page = WikiPage
::factory( $title );
17 $page->doEdit( 'Some text', 'inserting content' );
19 $apiResult = $this->doApiRequest( array(
21 'prop' => 'revisions',
22 'titles' => $pageName,
23 'rvprop' => 'content',
25 $this->assertArrayHasKey( 'query', $apiResult[0] );
26 $this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
27 foreach ( $apiResult[0]['query']['pages'] as $page ) {
28 $this->assertArrayHasKey( 'revisions', $page );
29 foreach ( $page['revisions'] as $revision ) {
30 $this->assertArrayHasKey( 'contentformat', $revision,
31 'contentformat should be included when asking content so client knows how to interpret it'
33 $this->assertArrayHasKey( 'contentmodel', $revision,
34 'contentmodel should be included when asking content so client knows how to interpret it'