diff options
Diffstat (limited to 'tests/config/ConfigPluginTest.php')
-rw-r--r-- | tests/config/ConfigPluginTest.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php index d7a70e68..b2cc0045 100644 --- a/tests/config/ConfigPluginTest.php +++ b/tests/config/ConfigPluginTest.php | |||
@@ -2,6 +2,7 @@ | |||
2 | namespace Shaarli\Config; | 2 | namespace Shaarli\Config; |
3 | 3 | ||
4 | use Shaarli\Config\Exception\PluginConfigOrderException; | 4 | use Shaarli\Config\Exception\PluginConfigOrderException; |
5 | use Shaarli\Plugin\PluginManager; | ||
5 | 6 | ||
6 | require_once 'application/config/ConfigPlugin.php'; | 7 | require_once 'application/config/ConfigPlugin.php'; |
7 | 8 | ||
@@ -17,23 +18,30 @@ class ConfigPluginTest extends \PHPUnit\Framework\TestCase | |||
17 | */ | 18 | */ |
18 | public function testSavePluginConfigValid() | 19 | public function testSavePluginConfigValid() |
19 | { | 20 | { |
20 | $data = array( | 21 | $data = [ |
21 | 'order_plugin1' => 2, // no plugin related | 22 | 'order_plugin1' => 2, // no plugin related |
22 | 'plugin2' => 0, // new - at the end | 23 | 'plugin2' => 0, // new - at the end |
23 | 'plugin3' => 0, // 2nd | 24 | 'plugin3' => 0, // 2nd |
24 | 'order_plugin3' => 8, | 25 | 'order_plugin3' => 8, |
25 | 'plugin4' => 0, // 1st | 26 | 'plugin4' => 0, // 1st |
26 | 'order_plugin4' => 5, | 27 | 'order_plugin4' => 5, |
27 | ); | 28 | ]; |
28 | 29 | ||
29 | $expected = array( | 30 | $expected = [ |
30 | 'plugin3', | 31 | 'plugin3', |
31 | 'plugin4', | 32 | 'plugin4', |
32 | 'plugin2', | 33 | 'plugin2', |
33 | ); | 34 | ]; |
35 | |||
36 | mkdir($path = __DIR__ . '/folder'); | ||
37 | PluginManager::$PLUGINS_PATH = $path; | ||
38 | array_map(function (string $plugin) use ($path) { touch($path . '/' . $plugin); }, $expected); | ||
34 | 39 | ||
35 | $out = save_plugin_config($data); | 40 | $out = save_plugin_config($data); |
36 | $this->assertEquals($expected, $out); | 41 | $this->assertEquals($expected, $out); |
42 | |||
43 | array_map(function (string $plugin) use ($path) { unlink($path . '/' . $plugin); }, $expected); | ||
44 | rmdir($path); | ||
37 | } | 45 | } |
38 | 46 | ||
39 | /** | 47 | /** |