aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/config/ConfigPluginTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-07-26 14:43:10 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-26 14:43:10 +0200
commit9fbc42294e7667c5ef19cafa0d1fcfbc1c0f36a9 (patch)
tree9bfc3c9b185eb0c185d23146d44d42dd6685a4da /tests/config/ConfigPluginTest.php
parentbc583903adfd768f115fae438e4d9ed1043682d9 (diff)
downloadShaarli-9fbc42294e7667c5ef19cafa0d1fcfbc1c0f36a9.tar.gz
Shaarli-9fbc42294e7667c5ef19cafa0d1fcfbc1c0f36a9.tar.zst
Shaarli-9fbc42294e7667c5ef19cafa0d1fcfbc1c0f36a9.zip
New basePath: fix officiel plugin paths and vintage template
Diffstat (limited to 'tests/config/ConfigPluginTest.php')
-rw-r--r--tests/config/ConfigPluginTest.php16
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 @@
2namespace Shaarli\Config; 2namespace Shaarli\Config;
3 3
4use Shaarli\Config\Exception\PluginConfigOrderException; 4use Shaarli\Config\Exception\PluginConfigOrderException;
5use Shaarli\Plugin\PluginManager;
5 6
6require_once 'application/config/ConfigPlugin.php'; 7require_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 /**