test: coverage recording now needs to be explicit
[mediawiki.git] / tests / phpunit / docs / ExportDemoTest.php
blobb09487a6e853e3c9cab87f5d13b8e76396cef8b9
1 <?php
2 /**
3 * Test for the demo xml
5 * @group Dump
6 */
7 class ExportDemoTest extends DumpTestCase {
9 /**
10 * @group large
12 function testExportDemo() {
13 $this->validateXmlFileAgainstXsd( "../../docs/export-demo.xml" );
16 /**
17 * Validates a xml file against the xsd.
19 * The validation is slow, because php has to read the xsd on each call.
21 * @param $fname string: name of file to validate
23 protected function validateXmlFileAgainstXsd( $fname ) {
24 $version = WikiExporter::schemaVersion();
26 $dom = new DomDocument();
27 $dom->load( $fname );
29 // Ensure, the demo is for the current version
30 $this->assertEquals( $dom->documentElement->getAttribute( 'version' ), $version, 'export-demo.xml should have the current version' );
32 try {
33 $this->assertTrue( $dom->schemaValidate( "../../docs/export-" . $version . ".xsd" ),
34 "schemaValidate has found an error" );
35 } catch ( Exception $e ) {
36 $this->fail( "xml not valid against xsd: " . $e->getMessage() );