]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/PluginManagerTest.php
Wallabag plugin: add version parameter in the meta file
[github/shaarli/Shaarli.git] / tests / PluginManagerTest.php
old mode 100755 (executable)
new mode 100644 (file)
index 749ce2b..348082c
@@ -13,15 +13,15 @@ class PluginManagerTest extends PHPUnit_Framework_TestCase
 {
     /**
      * Path to tests plugin.
-     * @var string $_PLUGIN_PATH
+     * @var string $pluginPath
      */
-    private static $_PLUGIN_PATH = 'tests/plugins';
+    private static $pluginPath = 'tests/plugins';
 
     /**
      * Test plugin.
-     * @var string $_PLUGIN_NAME
+     * @var string $pluginName
      */
-    private static $_PLUGIN_NAME = 'test';
+    private static $pluginName = 'test';
 
     /**
      * Test plugin loading and hook execution.
@@ -32,8 +32,8 @@ class PluginManagerTest extends PHPUnit_Framework_TestCase
     {
         $pluginManager = PluginManager::getInstance();
 
-        PluginManager::$PLUGINS_PATH = self::$_PLUGIN_PATH;
-        $pluginManager->load(array(self::$_PLUGIN_NAME));
+        PluginManager::$PLUGINS_PATH = self::$pluginPath;
+        $pluginManager->load(array(self::$pluginName));
 
         $this->assertTrue(function_exists('hook_test_random'));
 
@@ -63,4 +63,23 @@ class PluginManagerTest extends PHPUnit_Framework_TestCase
 
         $pluginManager->load(array('nope', 'renope'));
     }
+
+    /**
+     * Test plugin metadata loading.
+     */
+    public function testGetPluginsMeta()
+    {
+        $pluginManager = PluginManager::getInstance();
+
+        PluginManager::$PLUGINS_PATH = self::$pluginPath;
+        $pluginManager->load(array(self::$pluginName));
+
+        $expectedParameters = array(
+            'pop' => '',
+            'hip' => '',
+        );
+        $meta = $pluginManager->getPluginsMeta();
+        $this->assertEquals('test plugin', $meta[self::$pluginName]['description']);
+        $this->assertEquals($expectedParameters, $meta[self::$pluginName]['parameters']);
+    }
 }
\ No newline at end of file