Skip to content

Commit 4138552

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: fix typo remove the WriteConfig class DX: PHP CS Fixer - keep Annotation,NamedArgumentConstructor,Target annotations as single group do not install FrameworkBundle 6.4 [Tests] Add `array` return type for provider methods [Tests] Move expectException closer to the place of the expectation to avoid false positives
2 parents b77ebb4 + 4fd31b7 commit 4138552

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ class AddSecurityVotersPassTest extends TestCase
2424
{
2525
public function testNoVoters()
2626
{
27-
$this->expectException(LogicException::class);
28-
$this->expectExceptionMessage('No security voters found. You need to tag at least one with "security.voter".');
2927
$container = new ContainerBuilder();
3028
$container
3129
->register('security.access.decision_manager', AccessDecisionManager::class)
3230
->addArgument([])
3331
;
3432

3533
$compilerPass = new AddSecurityVotersPass();
34+
35+
$this->expectException(LogicException::class);
36+
$this->expectExceptionMessage('No security voters found. You need to tag at least one with "security.voter".');
37+
3638
$compilerPass->process($container);
3739
}
3840

Tests/DependencyInjection/MainConfigurationTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class MainConfigurationTest extends TestCase
3636

3737
public function testNoConfigForProvider()
3838
{
39-
$this->expectException(InvalidConfigurationException::class);
4039
$config = [
4140
'providers' => [
4241
'stub' => [],
@@ -45,12 +44,14 @@ public function testNoConfigForProvider()
4544

4645
$processor = new Processor();
4746
$configuration = new MainConfiguration([], []);
47+
48+
$this->expectException(InvalidConfigurationException::class);
49+
4850
$processor->processConfiguration($configuration, [$config]);
4951
}
5052

5153
public function testManyConfigForProvider()
5254
{
53-
$this->expectException(InvalidConfigurationException::class);
5455
$config = [
5556
'providers' => [
5657
'stub' => [
@@ -62,6 +63,9 @@ public function testManyConfigForProvider()
6263

6364
$processor = new Processor();
6465
$configuration = new MainConfiguration([], []);
66+
67+
$this->expectException(InvalidConfigurationException::class);
68+
6569
$processor->processConfiguration($configuration, [$config]);
6670
}
6771

Tests/DependencyInjection/Security/Factory/AccessTokenFactoryTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ public static function getOidcUserInfoConfiguration(): iterable
145145

146146
public function testMultipleTokenHandlersSet()
147147
{
148-
$this->expectException(InvalidConfigurationException::class);
149-
$this->expectExceptionMessage('You cannot configure multiple token handlers.');
150-
151148
$config = [
152149
'token_handler' => [
153150
'id' => 'in_memory_token_handler_service_id',
@@ -156,6 +153,10 @@ public function testMultipleTokenHandlersSet()
156153
];
157154

158155
$factory = new AccessTokenFactory($this->createTokenHandlerFactories());
156+
157+
$this->expectException(InvalidConfigurationException::class);
158+
$this->expectExceptionMessage('You cannot configure multiple token handlers.');
159+
159160
$this->processConfig($config, $factory);
160161
}
161162

Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class SecurityExtensionTest extends TestCase
4141
{
4242
public function testInvalidCheckPath()
4343
{
44-
$this->expectException(InvalidConfigurationException::class);
45-
$this->expectExceptionMessage('The check_path "/some_area/login_check" for login method "form_login" is not matched by the firewall pattern "/secured_area/.*".');
4644
$container = $this->getRawContainer();
4745

4846
$container->loadFromExtension('security', [
@@ -60,13 +58,14 @@ public function testInvalidCheckPath()
6058
],
6159
]);
6260

61+
$this->expectException(InvalidConfigurationException::class);
62+
$this->expectExceptionMessage('The check_path "/some_area/login_check" for login method "form_login" is not matched by the firewall pattern "/secured_area/.*".');
63+
6364
$container->compile();
6465
}
6566

6667
public function testFirewallWithInvalidUserProvider()
6768
{
68-
$this->expectException(InvalidConfigurationException::class);
69-
$this->expectExceptionMessage('Unable to create definition for "security.user.provider.concrete.my_foo" user provider');
7069
$container = $this->getRawContainer();
7170

7271
$extension = $container->getExtension('security');
@@ -85,6 +84,9 @@ public function testFirewallWithInvalidUserProvider()
8584
],
8685
]);
8786

87+
$this->expectException(InvalidConfigurationException::class);
88+
$this->expectExceptionMessage('Unable to create definition for "security.user.provider.concrete.my_foo" user provider');
89+
8890
$container->compile();
8991
}
9092

@@ -664,9 +666,6 @@ public static function provideEntryPointFirewalls(): iterable
664666
*/
665667
public function testEntryPointRequired(array $firewall, string $messageRegex)
666668
{
667-
$this->expectException(InvalidConfigurationException::class);
668-
$this->expectExceptionMessageMatches($messageRegex);
669-
670669
$container = $this->getRawContainer();
671670
$container->loadFromExtension('security', [
672671
'providers' => [
@@ -678,6 +677,9 @@ public function testEntryPointRequired(array $firewall, string $messageRegex)
678677
],
679678
]);
680679

680+
$this->expectException(InvalidConfigurationException::class);
681+
$this->expectExceptionMessageMatches($messageRegex);
682+
681683
$container->compile();
682684
}
683685

0 commit comments

Comments
 (0)