diff --git a/plugins/baser-core/src/Utility/BcPluginUtil.php b/plugins/baser-core/src/Utility/BcPluginUtil.php index 4c517e095e..c82cfca8ff 100644 --- a/plugins/baser-core/src/Utility/BcPluginUtil.php +++ b/plugins/baser-core/src/Utility/BcPluginUtil.php @@ -10,6 +10,9 @@ */ namespace BaserCore\Utility; +use BaserCore\Annotation\NoTodo; +use BaserCore\Annotation\Checked; +use BaserCore\Annotation\UnitTest; /** * Class BcPluginUtil @@ -21,6 +24,9 @@ class BcPluginUtil * プラグインのconfig内容を取得する * @param string $name * @return array + * @checked + * @noTodo + * @unitTest */ public static function getPluginConfig(string $name): array { diff --git a/plugins/baser-core/tests/TestCase/Utility/BcPluginUtilTest.php b/plugins/baser-core/tests/TestCase/Utility/BcPluginUtilTest.php new file mode 100644 index 0000000000..da53370ebc --- /dev/null +++ b/plugins/baser-core/tests/TestCase/Utility/BcPluginUtilTest.php @@ -0,0 +1,92 @@ +assertEquals($expected, $result); + + //clean up + if ($configContent !== null) { + unlink($configPath); + } + } + + public static function getPluginConfigDataProvider() + { + return [ + [ + 'non_existent_plugin', + null, + [ + 'type' => [], + 'title' => '', + 'description' => '', + 'author' => '', + 'url' => '', + 'adminLink' => '', + 'installMessage' => '', + ] + ], + + [ + 'test_plugin', + ' \'Plugin\', \'title\' => \'Test Plugin\'];', + [ + 'type' => ['Plugin'], + 'title' => 'Test Plugin', + 'description' => '', + 'author' => '', + 'url' => '', + 'adminLink' => '', + 'installMessage' => '', + ] + ], + + [ + 'test_plugin', + ' \'Plugin,CorePlugin\', \'title\' => \'Test Plugin\'];', + [ + 'type' => ['Plugin', 'CorePlugin'], + 'title' => 'Test Plugin', + 'description' => '', + 'author' => '', + 'url' => '', + 'adminLink' => '', + 'installMessage' => '', + ] + ] + ]; + } +}