X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fconfig%2FConfigPluginTest.php;h=b2cc00455284b8fe339caae0bd02b31f8f1ec696;hb=9fbc42294e7667c5ef19cafa0d1fcfbc1c0f36a9;hp=d7a70e6886b54a889eed845560350eae05cefabe;hpb=bc583903adfd768f115fae438e4d9ed1043682d9;p=github%2Fshaarli%2FShaarli.git 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); } /**