diff --git a/TestsGenerator/Generator.php b/TestsGenerator/Generator.php
index 19d1fb3..e40e466 100644
--- a/TestsGenerator/Generator.php
+++ b/TestsGenerator/Generator.php
@@ -9,7 +9,7 @@
namespace XSLTBenchmark\TestsGenerator;
-require_once __DIR__ . '/Templating.php';
+require_once __DIR__ . '/Templating/Templating.php';
require_once __DIR__ . '/Test.php';
require_once __DIR__ . '/Params/Params.php';
require_once LIBS . '/PhpPath/PhpPath.min.php';
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/AddAndGetTests.xml b/Tools/Tests/Unit/TestsGenerator/Generator/AddAndGetTests.xml
new file mode 100644
index 0000000..b7a1420
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/AddAndGetTests.xml
@@ -0,0 +1,27 @@
+
+
+
+ one.xml
+ two.xml
+ three.xml
+
+ 2
+ 5
+
+
+ 20
+
+
+
+
+
+ Lorem ipsum
+ 123
+
+
+
+
+
+ 999
+
+
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/AddAndGetTestsTest.php b/Tools/Tests/Unit/TestsGenerator/Generator/AddAndGetTestsTest.php
new file mode 100644
index 0000000..830d218
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/AddAndGetTestsTest.php
@@ -0,0 +1,93 @@
+
+ * @license "New" BSD License
+ */
+
+namespace Tests\XSLTBenchmark\TestsGenerator\Generator;
+
+require_once ROOT . '/TestsGenerator/Generator.php';
+require_once ROOT . '/TestsGenerator/Test.php';
+
+use \Tests\XSLTBenchmark\TestCase;
+use \XSLTBenchmark\TestsGenerator\Generator;
+use \XSLTBenchmark\TestsGenerator\Test;
+
+/**
+ * AddAndGetTestsTest
+ *
+ * @author Viktor Mašíček
+ *
+ * @covers \XSLTBenchmark\TestsGenerator\Generator::addTests
+ * @covers \XSLTBenchmark\TestsGenerator\Generator::getTests
+ */
+class AddAndGetTestsTest extends TestCase
+{
+
+
+ public function test()
+ {
+ $templates = $this->setDirSep(__DIR__ . '/A');
+ $templateXYZ = $this->setDirSep(__DIR__ . '/A/XYZ');
+ $tests = $this->setDirSep(__DIR__ . '/B');
+ $tmp = $this->setDirSep(__DIR__ . '/C');
+
+ mkdir($templates);
+ mkdir($templateXYZ);
+ mkdir($tests);
+ mkdir($tmp);
+
+ copy(
+ $this->setDirSep(__DIR__ . '/AddAndGetTests.xml'),
+ $this->setDirSep($templateXYZ . '/params.xml')
+ );
+
+ $generator = new Generator($templates, $tests, $tmp);
+ $generator->addTests('XYZ', 'params.xml');
+ $addedTests = $generator->getTests();
+
+ // make expected tests
+ $expectedTests = array();
+
+ // first test
+ $test = new Test('');
+ $this->setPropertyValue($test, 'name', 'Test name - First');
+ $this->setPropertyValue($test, 'templatePath', $this->setDirSep($templateXYZ . '/test.tpl.xslt'));
+ $this->setPropertyValue($test, 'templatingType', 'smarty');
+ $this->setPropertyValue($test, 'path', $this->setDirSep($tests . '/test-name-first'));
+ $this->setPropertyValue($test, 'settings', array('first seting' => 'Lorem ipsum', 'second setting' => 123));
+ $this->setPropertyValue($test, 'filesPaths', array(
+ $this->setDirSep($templateXYZ . '/one.xml') => $this->setDirSep($tmp . '/genOne.xml'),
+ $this->setDirSep($templateXYZ . '/two.xml') => $this->setDirSep($tmp . '/genTwo.xml'),
+ ));
+ $expectedTests[] = $test;
+
+ // second test
+ $test = new Test('');
+ $this->setPropertyValue($test, 'name', 'Test name - Second');
+ $this->setPropertyValue($test, 'templatePath', $this->setDirSep($templateXYZ . '/test.tpl.xslt'));
+ $this->setPropertyValue($test, 'templatingType', 'smarty');
+ $this->setPropertyValue($test, 'path', $this->setDirSep($tests . '/test-name-second'));
+ $this->setPropertyValue($test, 'settings', array('setting' => 999));
+ $this->setPropertyValue($test, 'filesPaths', array(
+ $this->setDirSep($templateXYZ . '/one.xml') => $this->setDirSep($tmp . '/genOne.xml'),
+ $this->setDirSep($templateXYZ . '/two.xml') => $this->setDirSep($tmp . '/genTwo.xml'),
+ $this->setDirSep($templateXYZ . '/three.xml') => $this->setDirSep($templateXYZ . '/one.xml'),
+ ));
+ $expectedTests[] = $test;
+
+ $this->assertEquals($expectedTests, $addedTests);
+
+ unlink($this->setDirSep($templateXYZ . '/params.xml'));
+ rmdir($templateXYZ);
+ rmdir($templates);
+ rmdir($tests);
+ unlink($this->setDirSep($tmp . '/genOne.xml'));
+ unlink($this->setDirSep($tmp . '/genTwo.xml'));
+ rmdir($tmp);
+ }
+
+}
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expectedTemplate1.xslt b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expectedTemplate1.xslt
new file mode 100644
index 0000000..9ab4e43
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expectedTemplate1.xslt
@@ -0,0 +1,4 @@
+My default text
+
+Lorem ipsum 1.1
+Lorem ipsum 1.2
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expectedTemplate2.xslt b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expectedTemplate2.xslt
new file mode 100644
index 0000000..818a84b
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expectedTemplate2.xslt
@@ -0,0 +1,4 @@
+My default text
+
+Lorem ipsum 2.1
+Lorem ipsum 2.2
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expected__params1.xml b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expected__params1.xml
new file mode 100644
index 0000000..d593a56
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expected__params1.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expected__params2.xml b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expected__params2.xml
new file mode 100644
index 0000000..c326fcf
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/expected__params2.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/genOne.xml b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/genOne.xml
new file mode 100644
index 0000000..b0e83bb
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/genOne.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/genTwo.xml b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/genTwo.xml
new file mode 100644
index 0000000..b0e83bb
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/genTwo.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/one.xml b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/one.xml
new file mode 100644
index 0000000..b0e83bb
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/one.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/template.tpl.xslt b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/template.tpl.xslt
new file mode 100644
index 0000000..053215a
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/template.tpl.xslt
@@ -0,0 +1,4 @@
+My default text
+
+{$testVariable1}
+{$testVariable2}
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/two.xml b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/two.xml
new file mode 100644
index 0000000..b0e83bb
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/FixtureGenerateAll/two.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/GenerateAllTest.php b/Tools/Tests/Unit/TestsGenerator/Generator/GenerateAllTest.php
new file mode 100644
index 0000000..603cfaf
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/GenerateAllTest.php
@@ -0,0 +1,147 @@
+
+ * @license "New" BSD License
+ */
+
+namespace Tests\XSLTBenchmark\TestsGenerator\Generator;
+
+require_once ROOT . '/TestsGenerator/Generator.php';
+require_once ROOT . '/TestsGenerator/Test.php';
+
+use \Tests\XSLTBenchmark\TestCase;
+use \XSLTBenchmark\TestsGenerator\Generator;
+use \XSLTBenchmark\TestsGenerator\Test;
+
+/**
+ * AddAndGetTestsTest
+ *
+ * @author Viktor Mašíček
+ *
+ * @covers \XSLTBenchmark\TestsGenerator\Generator::generateAll
+ * @covers \XSLTBenchmark\TestsGenerator\Generator::generateTest
+ * @covers \XSLTBenchmark\TestsGenerator\Generator::generateInputOutputCouples
+ */
+class GenerateAllTest extends TestCase
+{
+
+
+ public function test()
+ {
+ $fixture = $this->setDirSep(__DIR__ . '/FixtureGenerateAll');
+ $tests = $this->setDirSep(__DIR__ . '/tests');
+ mkdir($tests);
+
+ $generator = new Generator(__DIR__, __DIR__, __DIR__);
+
+ // make tests
+ $testsList = array();
+
+ // first test
+ $test = new Test('');
+ $this->setPropertyValue($test, 'name', 'Test name - First');
+ $this->setPropertyValue($test, 'templatePath', $this->setDirSep($fixture . '/template.tpl.xslt'));
+ $this->setPropertyValue($test, 'templatingType', 'smarty');
+ $this->setPropertyValue($test, 'path', $this->setDirSep($tests . '/test-name-first'));
+ $this->setPropertyValue($test, 'settings', array('testVariable1' => 'Lorem ipsum 1.1', 'testVariable2' => 'Lorem ipsum 1.2'));
+ $this->setPropertyValue($test, 'filesPaths', array(
+ $this->setDirSep($fixture . '/one.xml') => $this->setDirSep($fixture . '/genOne.xml'),
+ $this->setDirSep($fixture . '/two.xml') => $this->setDirSep($fixture . '/genTwo.xml'),
+ ));
+ $testsList[] = $test;
+
+ // second test
+ $test = new Test('');
+ $this->setPropertyValue($test, 'name', 'Test name - Second');
+ $this->setPropertyValue($test, 'templatePath', $this->setDirSep($fixture . '/template.tpl.xslt'));
+ $this->setPropertyValue($test, 'templatingType', 'smarty');
+ $this->setPropertyValue($test, 'path', $this->setDirSep($tests . '/test-name-second'));
+ $this->setPropertyValue($test, 'settings', array('testVariable1' => 'Lorem ipsum 2.1', 'testVariable2' => 'Lorem ipsum 2.2'));
+ $this->setPropertyValue($test, 'filesPaths', array(
+ $this->setDirSep($fixture . '/one.xml') => $this->setDirSep($fixture . '/genOne.xml'),
+ ));
+ $testsList[] = $test;
+
+ $this->setPropertyValue($generator, 'templates', $testsList);
+
+ // fisrt test
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-first/template.xslt'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-first/one.xml'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-first/genOne.xml'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-first/two.xml'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-first/genTwo.xml'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-first/__params.xml'));
+ // second test
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-second/template.xslt'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-second/one.xml'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-second/genOne.xml'));
+ $this->assertFileNotExists($this->setDirSep($tests . '/test-name-second/__params.xml'));
+
+ // generate all tests from template
+ $generator->generateAll();
+
+ // fisrt test
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-first/template.xslt'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-first/one.xml'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-first/genOne.xml'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-first/two.xml'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-first/genTwo.xml'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-first/__params.xml'));
+ // second test
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-second/template.xslt'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-second/one.xml'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-second/genOne.xml'));
+ $this->assertFileExists($this->setDirSep($tests . '/test-name-second/__params.xml'));
+
+ // content
+ $this->assertFileEquals(
+ $this->setDirSep($fixture . '/expectedTemplate1.xslt'),
+ $this->setDirSep($tests . '/test-name-first/template.xslt')
+ );
+ $this->assertFileEquals(
+ $this->setDirSep($fixture . '/expectedTemplate2.xslt'),
+ $this->setDirSep($tests . '/test-name-second/template.xslt')
+ );
+ $this->assertXmlFileEqualsXmlFile(
+ $this->setDirSep($fixture . '/expected__params1.xml'),
+ $this->setDirSep($tests . '/test-name-first/__params.xml')
+ );
+ $this->assertXmlFileEqualsXmlFile(
+ $this->setDirSep($fixture . '/expected__params2.xml'),
+ $this->setDirSep($tests . '/test-name-second/__params.xml')
+ );
+
+
+ // remove all generated files and directories
+ // fisrt test
+ unlink($this->setDirSep($tests . '/test-name-first/template.xslt'));
+ unlink($this->setDirSep($tests . '/test-name-first/one.xml'));
+ unlink($this->setDirSep($tests . '/test-name-first/genOne.xml'));
+ unlink($this->setDirSep($tests . '/test-name-first/two.xml'));
+ unlink($this->setDirSep($tests . '/test-name-first/genTwo.xml'));
+ unlink($this->setDirSep($tests . '/test-name-first/__params.xml'));
+ rmdir($this->setDirSep($tests . '/test-name-first'));
+ // second test
+ unlink($this->setDirSep($tests . '/test-name-second/template.xslt'));
+ unlink($this->setDirSep($tests . '/test-name-second/one.xml'));
+ unlink($this->setDirSep($tests . '/test-name-second/genOne.xml'));
+ unlink($this->setDirSep($tests . '/test-name-second/__params.xml'));
+ rmdir($this->setDirSep($tests . '/test-name-second'));
+
+ rmdir($tests);
+
+ // remove temporary file
+ $files = scandir(__DIR__);
+ foreach ($files as $file)
+ {
+ if (strpos($file, '.file.template.tpl.xslt.php') !== FALSE)
+ {
+ unlink($this->setDirSep(__DIR__ . '/' . $file));
+ }
+ }
+ }
+
+}
diff --git a/Tools/Tests/Unit/TestsGenerator/Generator/GeneratorTest.php b/Tools/Tests/Unit/TestsGenerator/Generator/GeneratorTest.php
new file mode 100644
index 0000000..9597047
--- /dev/null
+++ b/Tools/Tests/Unit/TestsGenerator/Generator/GeneratorTest.php
@@ -0,0 +1,74 @@
+
+ * @license "New" BSD License
+ */
+
+namespace Tests\XSLTBenchmark\TestsGenerator\Generator;
+
+require_once ROOT . '/TestsGenerator/Generator.php';
+
+use \Tests\XSLTBenchmark\TestCase;
+use \XSLTBenchmark\TestsGenerator\Generator;
+
+/**
+ * GeneratorTest
+ *
+ * @author Viktor Mašíček
+ *
+ * @covers \XSLTBenchmark\TestsGenerator\Generator::__construct
+ */
+class GeneratorTest extends TestCase
+{
+
+
+ public function testOk()
+ {
+ $templates = $this->setDirSep(__DIR__ . '/A');
+ $tests = $this->setDirSep(__DIR__ . '/B');
+ $tmp = $this->setDirSep(__DIR__ . '/C');
+
+ mkdir($templates);
+ mkdir($tests);
+ mkdir($tmp);
+
+ $generator = new Generator($templates, $tests, $tmp);
+
+ $this->assertEquals($templates, $this->getPropertyValue($generator, 'templatesDirectory'));
+ $this->assertEquals($tests, $this->getPropertyValue($generator, 'testsDirectory'));
+ $this->assertEquals($tmp, $this->getPropertyValue($generator, 'tmpDirectory'));
+
+ rmdir($templates);
+ rmdir($tests);
+ rmdir($tmp);
+ }
+
+
+ public function testBadTemplatedDir()
+ {
+ $unknown = $this->setDirSep(__DIR__ . '/unknown');
+ $this->setExpectedException('\PhpPath\NotExistsPathException');
+ $generator = new Generator($unknown, __DIR__, __DIR__);
+ }
+
+
+ public function testBadTestsDir()
+ {
+ $unknown = $this->setDirSep(__DIR__ . '/unknown');
+ $this->setExpectedException('\PhpPath\NotExistsPathException');
+ $generator = new Generator(__DIR__, $unknown, __DIR__);
+ }
+
+
+ public function testBadTmpDir()
+ {
+ $unknown = $this->setDirSep(__DIR__ . '/unknown');
+ $this->setExpectedException('\PhpPath\NotExistsPathException');
+ $generator = new Generator(__DIR__, __DIR__, $unknown);
+ }
+
+
+}