/** * @dataProvider provideIpsAndEnvironments */ public function testIpsAndEnvironments($exceptionThrown, $env, $incomingIp, $authorized) { $app = new Application($env); unset($app['exception_handler']); $app['phraseanet.configuration.config-path'] = __DIR__ . '/Fixtures/configuration-debugger.yml'; $app['phraseanet.configuration.config-compiled-path'] = __DIR__ . '/Fixtures/configuration-debugger.php'; if (is_file($app['phraseanet.configuration.config-compiled-path'])) { unlink($app['phraseanet.configuration.config-compiled-path']); } $app['conf']->set(['debugger', 'allowed-ips'], $authorized); $app['dispatcher']->addSubscriber(new DebuggerSubscriber($app)); $app->get('/', function () { return 'success'; }); $app->boot(); if ($exceptionThrown) { $this->setExpectedException('Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException'); } $app->handle(new Request([], [], [], [], [], ['REMOTE_ADDR' => $incomingIp])); }