From 6fc14d530369740d27d6bd641369d4f5f5f04080 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 15 Jul 2015 11:42:15 +0200 Subject: Plugin system - CORE see shaarli/Shaarli#275 --- tests/PluginManagerTest.php | 66 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 tests/PluginManagerTest.php (limited to 'tests/PluginManagerTest.php') diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php new file mode 100755 index 00000000..749ce2b5 --- /dev/null +++ b/tests/PluginManagerTest.php @@ -0,0 +1,66 @@ +load(array(self::$_PLUGIN_NAME)); + + $this->assertTrue(function_exists('hook_test_random')); + + $data = array(0 => 'woot'); + $pluginManager->executeHooks('random', $data); + $this->assertEquals('woot', $data[1]); + + $data = array(0 => 'woot'); + $pluginManager->executeHooks('random', $data, array('target' => 'test')); + $this->assertEquals('page test', $data[1]); + + $data = array(0 => 'woot'); + $pluginManager->executeHooks('random', $data, array('loggedin' => true)); + $this->assertEquals('loggedin', $data[1]); + } + + /** + * Test missing plugin loading. + * + * @return void + */ + public function testPluginNotFound() + { + $pluginManager = PluginManager::getInstance(); + + $pluginManager->load(array()); + + $pluginManager->load(array('nope', 'renope')); + } +} \ No newline at end of file -- cgit v1.2.3