7 class ApiQueryRevisionsTest
extends ApiTestCase
{
12 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'
32 . ' client knows how to interpretate it'
34 $this->assertArrayHasKey( 'contentmodel', $revision,
35 'contentmodel should be included when asking content so'
36 . ' client knows how to interpretate it'