Merge "xml dump maintenance scripts should use the 'dump' db group"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiMainTest.php
1 <?php
2
3 /**
4 * @group API
5 * @group Database
6 * @group medium
7 *
8 * @covers ApiMain
9 */
10 class ApiMainTest extends ApiTestCase {
11
12 /**
13 * Test that the API will accept a FauxRequest and execute. The help action
14 * (default) throws a UsageException. Just validate we're getting proper XML
15 *
16 * @expectedException UsageException
17 */
18 public function testApi() {
19 $api = new ApiMain(
20 new FauxRequest( array( 'action' => 'help', 'format' => 'xml' ) )
21 );
22 $api->execute();
23 $api->getPrinter()->setBufferResult( true );
24 $api->printResult( false );
25 $resp = $api->getPrinter()->getBuffer();
26
27 libxml_use_internal_errors( true );
28 $sxe = simplexml_load_string( $resp );
29 $this->assertNotInternalType( "bool", $sxe );
30 $this->assertThat( $sxe, $this->isInstanceOf( "SimpleXMLElement" ) );
31 }
32
33 }