wiki.techinc.nl/tests/phpunit/includes/api/ApiMainTest.php
addshore 79e8123466 Split ApiTest class into seperate module classes
Also!
 - adds @covers tags

Change-Id: I6d4f98f75cd3c2a52c982ece6dd295a4bf84a6fa
2013-11-05 12:40:50 +01:00

33 lines
805 B
PHP

<?php
/**
* @group API
* @group Database
* @group medium
*
* @covers ApiMain
*/
class ApiMainTest extends ApiTestCase {
/**
* Test that the API will accept a FauxRequest and execute. The help action
* (default) throws a UsageException. Just validate we're getting proper XML
*
* @expectedException UsageException
*/
public function testApi() {
$api = new ApiMain(
new FauxRequest( array( 'action' => 'help', 'format' => 'xml' ) )
);
$api->execute();
$api->getPrinter()->setBufferResult( true );
$api->printResult( false );
$resp = $api->getPrinter()->getBuffer();
libxml_use_internal_errors( true );
$sxe = simplexml_load_string( $resp );
$this->assertNotInternalType( "bool", $sxe );
$this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) );
}
}