X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fconfig%2FConfigPluginTest.php;h=fa72d8c4ae40438ccdac5af72c3734cd192fb0b5;hb=a5a9cf23acd1248585173aa32757d9720b5f2d62;hp=3b37cd7962cee974814872218277307258782420;hpb=adcdac1dec45090e2fa1cd4a340e91a40c7a205f;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php index 3b37cd79..fa72d8c4 100644 --- a/tests/config/ConfigPluginTest.php +++ b/tests/config/ConfigPluginTest.php @@ -1,14 +1,15 @@ 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); } /** * Test save_plugin_config with invalid data. - * - * @expectedException PluginConfigOrderException */ public function testSavePluginConfigInvalid() { + $this->expectException(\Shaarli\Config\Exception\PluginConfigOrderException::class); + $data = array( 'plugin2' => 0, 'plugin3' => 0,