2012-11-14 11:17:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group API
|
|
|
|
|
* @group Database
|
2013-01-18 19:02:28 +00:00
|
|
|
* @group medium
|
2013-10-24 10:04:00 +00:00
|
|
|
* @covers ApiQueryRevisions
|
2012-11-14 11:17:13 +00:00
|
|
|
*/
|
|
|
|
|
class ApiQueryRevisionsTest extends ApiTestCase {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group medium
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testContentComesWithContentModelAndFormat() {
|
2013-02-14 13:10:38 +00:00
|
|
|
$pageName = 'Help:' . __METHOD__;
|
2012-11-14 11:17:13 +00:00
|
|
|
$title = Title::newFromText( $pageName );
|
|
|
|
|
$page = WikiPage::factory( $title );
|
|
|
|
|
$page->doEdit( 'Some text', 'inserting content' );
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$apiResult = $this->doApiRequest( [
|
2012-11-14 11:17:13 +00:00
|
|
|
'action' => 'query',
|
|
|
|
|
'prop' => 'revisions',
|
|
|
|
|
'titles' => $pageName,
|
|
|
|
|
'rvprop' => 'content',
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
2012-11-14 11:17:13 +00:00
|
|
|
$this->assertArrayHasKey( 'query', $apiResult[0] );
|
|
|
|
|
$this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
|
2013-02-14 13:10:38 +00:00
|
|
|
foreach ( $apiResult[0]['query']['pages'] as $page ) {
|
2012-11-14 11:17:13 +00:00
|
|
|
$this->assertArrayHasKey( 'revisions', $page );
|
2013-02-14 13:10:38 +00:00
|
|
|
foreach ( $page['revisions'] as $revision ) {
|
2012-11-14 11:17:13 +00:00
|
|
|
$this->assertArrayHasKey( 'contentformat', $revision,
|
2013-02-08 06:45:19 +00:00
|
|
|
'contentformat should be included when asking content so client knows how to interpret it'
|
2012-11-14 11:17:13 +00:00
|
|
|
);
|
|
|
|
|
$this->assertArrayHasKey( 'contentmodel', $revision,
|
2013-02-08 06:45:19 +00:00
|
|
|
'contentmodel should be included when asking content so client knows how to interpret it'
|
2012-11-14 11:17:13 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|