diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/DebuggerSubscriberTest.php b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/DebuggerSubscriberTest.php index 308d0a9ced..ee899a026a 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/DebuggerSubscriberTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/DebuggerSubscriberTest.php @@ -12,8 +12,22 @@ use Symfony\Component\HttpFoundation\Request; */ class DebuggerSubscriberTest extends \PhraseanetTestCase { + private $bkp = null; + + public function setUp() + { + parent::setUp(); + $this->bkp = self::$DI['app']['conf']->get('debugger'); + } + public function tearDown() { + if(is_null($this->bkp)) { + self::$DI['app']['conf']->remove('debugger'); + } + else { + self::$DI['app']['conf']->set('debugger', $this->bkp); + } if (is_file(__DIR__ . '/Fixtures/configuration-debugger.php')) { unlink(__DIR__ . '/Fixtures/configuration-debugger.php'); } @@ -35,8 +49,6 @@ class DebuggerSubscriberTest extends \PhraseanetTestCase unlink($app['phraseanet.configuration.config-compiled-path']); } - $bkp = $app['conf']->get('debugger'); - $app['conf']->set(['debugger', 'allowed-ips'], $authorized); $app['dispatcher']->addSubscriber(new DebuggerSubscriber($app)); @@ -50,14 +62,7 @@ class DebuggerSubscriberTest extends \PhraseanetTestCase $this->setExpectedException('Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException'); } - try { - $app->handle(new Request([], [], [], [], [], ['REMOTE_ADDR' => $incomingIp])); - } - catch (\Exception $e) { - // no-op - } - - $app['conf']->set('debugger', $bkp); + $app->handle(new Request([], [], [], [], [], ['REMOTE_ADDR' => $incomingIp])); } public function provideIpsAndEnvironments() diff --git a/tests/Alchemy/Tests/Phrasea/Plugin/PluginManagerTest.php b/tests/Alchemy/Tests/Phrasea/Plugin/PluginManagerTest.php index 39f676e4d1..16288b353b 100644 --- a/tests/Alchemy/Tests/Phrasea/Plugin/PluginManagerTest.php +++ b/tests/Alchemy/Tests/Phrasea/Plugin/PluginManagerTest.php @@ -11,26 +11,6 @@ use Alchemy\Phrasea\Plugin\Schema\PluginValidator; */ class PluginManagerTest extends PluginTestCase { - private $bkp; - - public function setUp() - { - parent::setUp(); - $this->bkp = self::$DI['app']['conf']->get('plugins'); - } - - public function tearDown() - { - if(is_null($this->bkp)) { - self::$DI['app']['conf']->remove('plugins'); - } - else { - self::$DI['app']['conf']->set('plugins', $this->bkp); - } - parent::tearDown(); - } - - public function testListGoodPlugins() { $prevPlugins = self::$DI['cli']['conf']->get('plugins'); @@ -67,9 +47,16 @@ class PluginManagerTest extends PluginTestCase public function testHasPlugin() { + $prevPlugins = self::$DI['cli']['conf']->get('plugins'); + + self::$DI['cli']['conf']->set('plugins', []); + self::$DI['cli']['conf']->set(['plugins', 'test-plugin', 'enabled'], true); + $manager = new PluginManager(__DIR__ . '/Fixtures/PluginDirInstalled', self::$DI['cli']['plugins.plugins-validator'], self::$DI['cli']['conf']); $this->assertTrue($manager->hasPlugin('test-plugin')); $this->assertFalse($manager->hasPlugin('test-plugin2')); + + self::$DI['cli']['conf']->set('plugins', $prevPlugins); } private function createValidatorMock()