Merge "Add pp_propname_page index to page_props"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / query / ApiQueryRevisionsTest.php
1 <?php
2
3 /**
4 * @group API
5 * @group Database
6 * @group medium
7 */
8 class ApiQueryRevisionsTest extends ApiTestCase {
9
10 /**
11 * @group medium
12 */
13 function testContentComesWithContentModelAndFormat() {
14 $pageName = 'Help:' . __METHOD__;
15 $title = Title::newFromText( $pageName );
16 $page = WikiPage::factory( $title );
17 $page->doEdit( 'Some text', 'inserting content' );
18
19 $apiResult = $this->doApiRequest( array(
20 'action' => 'query',
21 'prop' => 'revisions',
22 'titles' => $pageName,
23 'rvprop' => 'content',
24 ) );
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'
32 );
33 $this->assertArrayHasKey( 'contentmodel', $revision,
34 'contentmodel should be included when asking content so client knows how to interpret it'
35 );
36 }
37 }
38 }
39 }