Merge "Clean up applyPatch() usage in the installer."
[lhc/web/wiklou.git] / tests / phpunit / docs / ExportDemoTest.php
1 <?php
2 /**
3 * Test for the demo xml
4 *
5 * @group Dump
6 */
7 class ExportDemoTest extends DumpTestCase {
8
9 /**
10 * @group large
11 */
12 function testExportDemo() {
13 $this->validateXmlFileAgainstXsd( "../../docs/export-demo.xml" );
14 }
15
16 /**
17 * Validates a xml file against the xsd.
18 *
19 * The validation is slow, because php has to read the xsd on each call.
20 *
21 * @param $fname string: name of file to validate
22 */
23 protected function validateXmlFileAgainstXsd( $fname ) {
24 $version = WikiExporter::schemaVersion();
25
26 $dom = new DomDocument();
27 $dom->load( $fname );
28
29 try {
30 $this->assertTrue( $dom->schemaValidate( "../../docs/export-" . $version . ".xsd" ),
31 "schemaValidate has found an error" );
32 } catch( Exception $e ) {
33 $this->fail( "xml not valid against xsd: " . $e->getMessage() );
34 }
35 }
36 }