From 9fbc42294e7667c5ef19cafa0d1fcfbc1c0f36a9 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 26 Jul 2020 14:43:10 +0200 Subject: New basePath: fix officiel plugin paths and vintage template --- tests/config/ConfigPluginTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tests/config/ConfigPluginTest.php') 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 @@ namespace Shaarli\Config; use Shaarli\Config\Exception\PluginConfigOrderException; +use Shaarli\Plugin\PluginManager; require_once 'application/config/ConfigPlugin.php'; @@ -17,23 +18,30 @@ class ConfigPluginTest extends \PHPUnit\Framework\TestCase */ public function testSavePluginConfigValid() { - $data = array( + $data = [ 'order_plugin1' => 2, // no plugin related 'plugin2' => 0, // new - at the end 'plugin3' => 0, // 2nd 'order_plugin3' => 8, 'plugin4' => 0, // 1st 'order_plugin4' => 5, - ); + ]; - $expected = array( + $expected = [ 'plugin3', 'plugin4', 'plugin2', - ); + ]; + + mkdir($path = __DIR__ . '/folder'); + PluginManager::$PLUGINS_PATH = $path; + array_map(function (string $plugin) use ($path) { touch($path . '/' . $plugin); }, $expected); $out = save_plugin_config($data); $this->assertEquals($expected, $out); + + array_map(function (string $plugin) use ($path) { unlink($path . '/' . $plugin); }, $expected); + rmdir($path); } /** -- cgit v1.2.3