From: georggi Date: Tue, 5 Jan 2016 12:02:03 +0000 (+0200) Subject: PHPUnit: Added test for unknown tags X-Git-Tag: 1.31.0-rc.0~8447^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=c11667a4ca284ae44238bdd2848e3ebbc3442782;p=lhc%2Fweb%2Fwiklou.git PHPUnit: Added test for unknown tags Bug: T43938 Change-Id: Idcb1576db39cc1d925207a37b4f22b40d76fea8b --- diff --git a/tests/phpunit/includes/import/ImportTest.php b/tests/phpunit/includes/import/ImportTest.php index 9c224309bb..f4aac235a2 100644 --- a/tests/phpunit/includes/import/ImportTest.php +++ b/tests/phpunit/includes/import/ImportTest.php @@ -13,6 +13,66 @@ class ImportTest extends MediaWikiLangTestCase { return new ImportStringSource( $xml ); } + /** + * @covers WikiImporter + * @dataProvider getUnknownTagsXML + * @param string $xml + * @param string $text + * @param string $title + */ + public function testUnknownXMLTags( $xml, $text, $title ) { + $source = $this->getDataSource( $xml ); + + $importer = new WikiImporter( + $source, + ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) + ); + + $importer->doImport(); + $title = Title::newFromText( $title ); + $this->assertTrue( $title->exists() ); + + $this->assertEquals( WikiPage::factory( $title )->getContent()->getNativeData(), $text ); + } + + public function getUnknownTagsXML() { + // @codingStandardsIgnoreStart Generic.Files.LineLength + return array( + array( + <<< EOF + + + TestImportPage + Should be ignored + 0 + 14 + + 15 + Should be ignored + 2016-01-03T11:18:43Z + + Should be ignored + Admin + 1 + + wikitext + text/x-wiki + noitazinagro tseb eht si ikiWaideM + phoiac9h4m842xq45sp7s6u21eteeq1 + Should be ignored + + + Should be ignored + +EOF + , + 'noitazinagro tseb eht si ikiWaideM', + 'TestImportPage' + ) + ); + // @codingStandardsIgnoreEnd + } + /** * @covers WikiImporter::handlePage * @dataProvider getRedirectXML