From 3f63cad1762b2a444fbbe4d857a8255564989eaf Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Thu, 23 Dec 2021 15:44:02 +0100 Subject: [PATCH] More unittests --- tests/Pipe/PipelineTest.php | 27 ++++++++++++++++++++++++++ tests/Plugin/PluginManagerTest.php | 31 ++++++++++++++++++++++++++++++ tests/spark.json | 3 +++ 3 files changed, 61 insertions(+) create mode 100644 tests/Pipe/PipelineTest.php create mode 100644 tests/Plugin/PluginManagerTest.php create mode 100644 tests/spark.json diff --git a/tests/Pipe/PipelineTest.php b/tests/Pipe/PipelineTest.php new file mode 100644 index 0000000..10e21dc --- /dev/null +++ b/tests/Pipe/PipelineTest.php @@ -0,0 +1,27 @@ +setInputFile("/tmp/rand.in"); + $pipe->setOutputFile("/tmp/rand.out"); + $pipe->run(); + + $out = file_get_contents("/tmp/rand.out"); + $this->assertEquals($rand, $out); + } +} diff --git a/tests/Plugin/PluginManagerTest.php b/tests/Plugin/PluginManagerTest.php new file mode 100644 index 0000000..d7374ff --- /dev/null +++ b/tests/Plugin/PluginManagerTest.php @@ -0,0 +1,31 @@ +registerPlugin('test.testplugin', $plugin); + + $gplugin = $manager->getPlugin('test.testplugin'); + + $this->assertEquals($plugin, $gplugin); + } +} + +class TestPlugin extends SparkPlug +{ + public function load() + {} +} \ No newline at end of file diff --git a/tests/spark.json b/tests/spark.json new file mode 100644 index 0000000..cc41888 --- /dev/null +++ b/tests/spark.json @@ -0,0 +1,3 @@ +{ + "preload": [ "./.spark/plugins/*" ] +}