7 * @covers ApiQueryRevisions
9 class ApiQueryRevisionsTest
extends ApiTestCase
{
14 public function testContentComesWithContentModelAndFormat() {
15 $pageName = 'Help:' . __METHOD__
;
16 $title = Title
::newFromText( $pageName );
17 $page = WikiPage
::factory( $title );
20 ContentHandler
::makeContent( 'Some text', $page->getTitle() ),
24 $apiResult = $this->doApiRequest( [
26 'prop' => 'revisions',
27 'titles' => $pageName,
28 'rvprop' => 'content',
31 $this->assertArrayHasKey( 'query', $apiResult[0] );
32 $this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
33 foreach ( $apiResult[0]['query']['pages'] as $page ) {
34 $this->assertArrayHasKey( 'revisions', $page );
35 foreach ( $page['revisions'] as $revision ) {
36 $this->assertArrayHasKey( 'slots', $revision );
37 $this->assertArrayHasKey( 'main', $revision['slots'] );
38 $this->assertArrayHasKey( 'contentformat', $revision['slots']['main'],
39 'contentformat should be included when asking content so client knows how to interpret it'
41 $this->assertArrayHasKey( 'contentmodel', $revision['slots']['main'],
42 'contentmodel should be included when asking content so client knows how to interpret it'