From ab30bae46aae69196e0ebef3e3bada6bfe51082d Mon Sep 17 00:00:00 2001 From: Molkobain Date: Mon, 10 May 2021 13:49:08 +0200 Subject: [PATCH] Tests: Rename test and move samples to dedicated directory --- .../1.7_to_1.6.expected.xml | 0 .../1.7_to_1.6.input.xml | 0 .../1.7_to_3.0.expected.xml | 0 .../1.7_to_3.0.input.xml | 0 .../3.0_to_1.7.expected.xml | 0 .../3.0_to_1.7.input.xml | 0 .../iTopDesignFormat/iTopDesignFormatTest.php | 27 ++++++++++--------- 7 files changed, 14 insertions(+), 13 deletions(-) rename test/setup/iTopDesignFormat/{ => Convert-samples}/1.7_to_1.6.expected.xml (100%) rename test/setup/iTopDesignFormat/{ => Convert-samples}/1.7_to_1.6.input.xml (100%) rename test/setup/iTopDesignFormat/{ => Convert-samples}/1.7_to_3.0.expected.xml (100%) rename test/setup/iTopDesignFormat/{ => Convert-samples}/1.7_to_3.0.input.xml (100%) rename test/setup/iTopDesignFormat/{ => Convert-samples}/3.0_to_1.7.expected.xml (100%) rename test/setup/iTopDesignFormat/{ => Convert-samples}/3.0_to_1.7.input.xml (100%) diff --git a/test/setup/iTopDesignFormat/1.7_to_1.6.expected.xml b/test/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6.expected.xml similarity index 100% rename from test/setup/iTopDesignFormat/1.7_to_1.6.expected.xml rename to test/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6.expected.xml diff --git a/test/setup/iTopDesignFormat/1.7_to_1.6.input.xml b/test/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6.input.xml similarity index 100% rename from test/setup/iTopDesignFormat/1.7_to_1.6.input.xml rename to test/setup/iTopDesignFormat/Convert-samples/1.7_to_1.6.input.xml diff --git a/test/setup/iTopDesignFormat/1.7_to_3.0.expected.xml b/test/setup/iTopDesignFormat/Convert-samples/1.7_to_3.0.expected.xml similarity index 100% rename from test/setup/iTopDesignFormat/1.7_to_3.0.expected.xml rename to test/setup/iTopDesignFormat/Convert-samples/1.7_to_3.0.expected.xml diff --git a/test/setup/iTopDesignFormat/1.7_to_3.0.input.xml b/test/setup/iTopDesignFormat/Convert-samples/1.7_to_3.0.input.xml similarity index 100% rename from test/setup/iTopDesignFormat/1.7_to_3.0.input.xml rename to test/setup/iTopDesignFormat/Convert-samples/1.7_to_3.0.input.xml diff --git a/test/setup/iTopDesignFormat/3.0_to_1.7.expected.xml b/test/setup/iTopDesignFormat/Convert-samples/3.0_to_1.7.expected.xml similarity index 100% rename from test/setup/iTopDesignFormat/3.0_to_1.7.expected.xml rename to test/setup/iTopDesignFormat/Convert-samples/3.0_to_1.7.expected.xml diff --git a/test/setup/iTopDesignFormat/3.0_to_1.7.input.xml b/test/setup/iTopDesignFormat/Convert-samples/3.0_to_1.7.input.xml similarity index 100% rename from test/setup/iTopDesignFormat/3.0_to_1.7.input.xml rename to test/setup/iTopDesignFormat/Convert-samples/3.0_to_1.7.input.xml diff --git a/test/setup/iTopDesignFormat/iTopDesignFormatTest.php b/test/setup/iTopDesignFormat/iTopDesignFormatTest.php index f1c054440..c108468db 100644 --- a/test/setup/iTopDesignFormat/iTopDesignFormatTest.php +++ b/test/setup/iTopDesignFormat/iTopDesignFormatTest.php @@ -31,7 +31,7 @@ class TestForITopDesignFormatClass extends ItopTestCase /** * @covers iTopDesignFormat::Convert - * @dataProvider MigrationMethodProvider + * @dataProvider ConvertProvider * * @param string $sTargetVersion * @param string $sInputXmlFileName example "1.7_to_1.6.input" @@ -39,10 +39,11 @@ class TestForITopDesignFormatClass extends ItopTestCase * * @throws \Exception */ - public function testMigrationMethod($sTargetVersion, $sInputXmlFileName, $sExpectedXmlFileName) + public function testConvert($sTargetVersion, $sXmlFileName) { - $sInputXml = $this->GetFileContent($sInputXmlFileName); - $sExpectedXml = $this->GetFileContent($sExpectedXmlFileName); + $sSamplesRelDirPath = 'Convert-samples/'; + $sInputXml = $this->GetFileContent($sSamplesRelDirPath.$sXmlFileName.'.input'); + $sExpectedXml = $this->GetFileContent($sSamplesRelDirPath.$sXmlFileName.'.expected'); $oInputDocument = new DOMDocument(); libxml_clear_errors(); @@ -56,19 +57,19 @@ class TestForITopDesignFormatClass extends ItopTestCase $this->assertEquals($sExpectedXml, $sConvertedXml); } + public function ConvertProvider() + { + return array( + '1.7 to 1.6' => array('1.6', '1.7_to_1.6'), + '1.7 to 3.0' => array('3.0', '1.7_to_3.0'), + '3.0 to 1.7' => array('1.7', '3.0_to_1.7'), + ); + } + private function GetFileContent($sFileName) { $sCurrentPath = __DIR__; return file_get_contents($sCurrentPath.DIRECTORY_SEPARATOR.$sFileName.'.xml'); } - - public function MigrationMethodProvider() - { - return array( - '1.7 to 1.6' => array('1.6', '1.7_to_1.6.input', '1.7_to_1.6.expected'), - '1.7 to 3.0' => array('3.0', '1.7_to_3.0.input', '1.7_to_3.0.expected'), - '3.0 to 1.7' => array('1.7', '3.0_to_1.7.input', '3.0_to_1.7.expected'), - ); - } } \ No newline at end of file