MediaWiki REL1_30
ApiQueryRevisionsTest.php
Go to the documentation of this file.
1<?php
2
10
15 $pageName = 'Help:' . __METHOD__;
16 $title = Title::newFromText( $pageName );
17 $page = WikiPage::factory( $title );
18
19 $page->doEditContent(
20 ContentHandler::makeContent( 'Some text', $page->getTitle() ),
21 'inserting content'
22 );
23
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'
37 );
38 $this->assertArrayHasKey( 'contentmodel', $revision,
39 'contentmodel should be included when asking content so client knows how to interpret it'
40 );
41 }
42 }
43 }
44}
API Database medium ApiQueryRevisions.
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null)
Does the API request and returns the result.
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition WikiPage.php:121