Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / api / query / ApiQueryRevisionsTest.php
blob38a1d6859188e40358852735a8fae24b2bea71ee
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 );
19 $page->doEditContent(
20 ContentHandler::makeContent( 'Some text', $page->getTitle() ),
21 'inserting content'
24 $apiResult = $this->doApiRequest( [
25 'action' => 'query',
26 'prop' => 'revisions',
27 'titles' => $pageName,
28 'rvprop' => 'content',
29 ] );
30 $this->assertArrayHasKey( 'query', $apiResult[0] );
31 $this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
32 foreach ( $apiResult[0]['query']['pages'] as $page ) {
33 $this->assertArrayHasKey( 'revisions', $page );
34 foreach ( $page['revisions'] as $revision ) {
35 $this->assertArrayHasKey( 'contentformat', $revision,
36 'contentformat should be included when asking content so client knows how to interpret it'
38 $this->assertArrayHasKey( 'contentmodel', $revision,
39 'contentmodel should be included when asking content so client knows how to interpret it'