minor #25128 [SecurityBundle][Console] Remove dead code, add missing test (chalasr)

This PR was merged into the 4.0 branch.

Discussion
----------

[SecurityBundle][Console] Remove dead code, add missing test

| Q             | A
| ------------- | ---
| Branch?       | 4.0
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

190df1a Remove dead code, add missing test
This commit is contained in:
Nicolas Grekas 2017-11-23 13:16:27 +01:00
commit 7a33b017e9
2 changed files with 27 additions and 2 deletions

View File

@ -168,6 +168,31 @@ class SecurityExtensionTest extends TestCase
$this->addToAssertionCount(1);
}
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage Not configuring explicitly the provider for the "http_basic" listener on "ambiguous" firewall is ambiguous as there is more than one registered provider.
*/
public function testMissingProviderForListener()
{
$container = $this->getRawContainer();
$container->loadFromExtension('security', array(
'providers' => array(
'first' => array('id' => 'foo'),
'second' => array('id' => 'bar'),
),
'firewalls' => array(
'ambiguous' => array(
'http_basic' => true,
'form_login' => array('provider' => 'second'),
'logout_on_user_change' => true,
),
),
));
$container->compile();
}
protected function getRawContainer()
{
$container = new ContainerBuilder();

View File

@ -120,8 +120,8 @@ class Application
try {
$exitCode = $this->doRun($input, $output);
} catch (\Throwable $e) {
if (!$this->catchExceptions || !$e instanceof \Exception) {
} catch (\Exception $e) {
if (!$this->catchExceptions) {
throw $e;
}