mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 09:53:15 +00:00
PHRAS-2859_tests-do-corrupt-conf_4.1
fix tests
This commit is contained in:
@@ -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()
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user