Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / api / query / ApiQueryRevisionsTest.php
blob74ceff90c7b126d66eeccb52b731399a75ad22e2
1 <?php
3 /**
4 * @group API
5 * @group Database
6 * @group medium
7 * @covers ApiQueryRevisions
8 */
9 class ApiQueryRevisionsTest extends ApiTestCase {
11 /**
12 * @group medium
14 public function testContentComesWithContentModelAndFormat() {
15 $pageName = 'Help:' . __METHOD__;
16 $title = Title::newFromText( $pageName );
17 $page = WikiPage::factory( $title );
18 $page->doEdit( 'Some text', 'inserting content' );
20 $apiResult = $this->doApiRequest( array(
21 'action' => 'query',
22 'prop' => 'revisions',
23 'titles' => $pageName,
24 'rvprop' => 'content',
25 ) );
26 $this->assertArrayHasKey( 'query', $apiResult[0] );
27 $this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
28 foreach ( $apiResult[0]['query']['pages'] as $page ) {
29 $this->assertArrayHasKey( 'revisions', $page );
30 foreach ( $page['revisions'] as $revision ) {
31 $this->assertArrayHasKey( 'contentformat', $revision,
32 'contentformat should be included when asking content so client knows how to interpret it'
34 $this->assertArrayHasKey( 'contentmodel', $revision,
35 'contentmodel should be included when asking content so client knows how to interpret it'