MediaWiki  REL1_21
ExportDemoTest.php
Go to the documentation of this file.
00001 <?php
00007 class ExportDemoTest extends DumpTestCase {
00008 
00012         function testExportDemo() {
00013                 $this->validateXmlFileAgainstXsd( "../../docs/export-demo.xml" );
00014         }
00015 
00023         protected function validateXmlFileAgainstXsd( $fname ) {
00024                 $version = WikiExporter::schemaVersion();
00025 
00026                 $dom = new DomDocument();
00027                 $dom->load( $fname );
00028 
00029                 // Ensure, the demo is for the current version
00030                 $this->assertEquals( $dom->documentElement->getAttribute( 'version' ), $version, 'export-demo.xml should have the current version' );
00031 
00032                 try {
00033                         $this->assertTrue( $dom->schemaValidate( "../../docs/export-" . $version . ".xsd" ),
00034                                 "schemaValidate has found an error" );
00035                 } catch ( Exception $e ) {
00036                         $this->fail( "xml not valid against xsd: " . $e->getMessage() );
00037                 }
00038         }
00039 }