X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fdocs%2FExportDemoTest.php;h=8288cae0f2590bbc280e5d89d9cf1a30da3428be;hb=ca419b4e5396383e07f61aa00daf3f202bc808e9;hp=ce65d494b5464c0892cbaced59116e46e8267b5d;hpb=eeb7300f6004e95620514eb9bac508425e94f197;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/docs/ExportDemoTest.php b/tests/phpunit/docs/ExportDemoTest.php index ce65d494b5..8288cae0f2 100644 --- a/tests/phpunit/docs/ExportDemoTest.php +++ b/tests/phpunit/docs/ExportDemoTest.php @@ -1,36 +1,31 @@ validateXmlFileAgainstXsd( "../../docs/export-demo.xml" ); - } - - /** - * Validates a xml file against the xsd. - * - * The validation is slow, because php has to read the xsd on each call. - * - * @param $fname string: name of file to validate - */ - protected function validateXmlFileAgainstXsd( $fname ) { + public function testExportDemo() { + $fname = "../../docs/export-demo.xml"; $version = WikiExporter::schemaVersion(); - $dom = new DomDocument(); $dom->load( $fname ); - try { - $this->assertTrue( $dom->schemaValidate( "../../docs/export-" . $version . ".xsd" ), - "schemaValidate has found an error" ); - } catch( Exception $e ) { - $this->fail( "xml not valid against xsd: " . $e->getMessage() ); - } + // Ensure, the demo is for the current version + $this->assertEquals( + $dom->documentElement->getAttribute( 'version' ), + $version, + 'export-demo.xml should have the current version' + ); + + $this->assertTrue( + $dom->schemaValidate( "../../docs/export-" . $version . ".xsd" ), + "schemaValidate has found an error" + ); } + }