wiki.techinc.nl/tests/phpunit/includes/api/ApiQueryRevisionsTest.php
Brad Jorsch 252ae6268b (bug 43762) Mark slow unit test as @group medium
All tests based on APITestCase can be slow. I've also seen more than one
Jenkins failure due to GlobalTest::testMerge timing out.

Also, added a meta-test on APITestCase to make sure that all its
subclasses are marked with @group medium or @group large, to prevent new
tests from re-causing the bug.

Change-Id: I48630736a3d06574876fd1fa3d90899cfbc48012
2013-01-18 14:07:49 -05:00

42 lines
1.1 KiB
PHP

<?php
/**
* @group API
* @group Database
* @group medium
*/
class ApiQueryRevisionsTest extends ApiTestCase {
/**
* @group medium
*/
function testContentComesWithContentModelAndFormat() {
$pageName = 'Help:' . __METHOD__ ;
$title = Title::newFromText( $pageName );
$page = WikiPage::factory( $title );
$page->doEdit( 'Some text', 'inserting content' );
$apiResult = $this->doApiRequest( array(
'action' => 'query',
'prop' => 'revisions',
'titles' => $pageName,
'rvprop' => 'content',
) );
$this->assertArrayHasKey( 'query', $apiResult[0] );
$this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
foreach( $apiResult[0]['query']['pages'] as $page ) {
$this->assertArrayHasKey( 'revisions', $page );
foreach( $page['revisions'] as $revision ) {
$this->assertArrayHasKey( 'contentformat', $revision,
'contentformat should be included when asking content so'
. ' client knows how to interpretate it'
);
$this->assertArrayHasKey( 'contentmodel', $revision,
'contentmodel should be included when asking content so'
. ' client knows how to interpretate it'
);
}
}
}
}