Skip to content

Commit f32ffeb

Browse files
Merge branch '6.4' into 7.0
* 6.4: [Console] Fix horizontal table top border is incorrectly rendered [Tests] Streamline [AssetMapper] Fixing bug where JSCompiler used non-absolute importmap entry path [FrameworkBundle] Fix BC break about enable_annotations in validation and serializer configuration [Uid] Fix UuidV7 collisions within the same ms [Validator] updated Romanian translation
2 parents 7bde295 + 8ee5074 commit f32ffeb

File tree

8 files changed

+63
-15
lines changed

8 files changed

+63
-15
lines changed

Tests/DataCollector/SecurityDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public function dispatch(object $event, string $eventName = null): object
397397
$this->assertSame($dataCollector->getVoterStrategy(), $strategy, 'Wrong value returned by getVoterStrategy');
398398
}
399399

400-
public static function provideRoles()
400+
public static function provideRoles(): array
401401
{
402402
return [
403403
// Basic roles

Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,27 @@ public function testSecretRememberMeHasher()
538538
$this->assertSame('very', $handler->getArgument(2));
539539
}
540540

541-
public function sessionConfigurationProvider()
541+
public function testSecretRememberMeHandler()
542+
{
543+
$container = $this->getRawContainer();
544+
545+
$container->register('custom_remember_me', \stdClass::class);
546+
$container->loadFromExtension('security', [
547+
'enable_authenticator_manager' => true,
548+
'firewalls' => [
549+
'default' => [
550+
'remember_me' => ['secret' => 'very', 'token_provider' => 'token_provider_id'],
551+
],
552+
],
553+
]);
554+
555+
$container->compile();
556+
557+
$handler = $container->getDefinition('security.authenticator.remember_me_handler.default');
558+
$this->assertSame('very', $handler->getArgument(1));
559+
}
560+
561+
public static function sessionConfigurationProvider(): array
542562
{
543563
return [
544564
[
@@ -642,10 +662,27 @@ public function testValidAccessControlWithEmptyRow()
642662
$this->assertTrue(true, 'extension throws an InvalidConfigurationException if there is one more more empty access control items');
643663
}
644664

665+
public static function provideEntryPointFirewalls(): iterable
666+
{
667+
// only one entry point available
668+
yield [['http_basic' => true], 'security.authenticator.http_basic.main'];
669+
// explicitly configured by authenticator key
670+
yield [['form_login' => true, 'http_basic' => true, 'entry_point' => 'form_login'], 'security.authenticator.form_login.main'];
671+
// explicitly configured another service
672+
yield [['form_login' => true, 'entry_point' => EntryPointStub::class], EntryPointStub::class];
673+
// no entry point required
674+
yield [['json_login' => true], null];
675+
676+
// only one guard authenticator entry point available
677+
yield [[
678+
'guard' => ['authenticators' => [AppCustomAuthenticator::class]],
679+
], 'security.authenticator.guard.main.0'];
680+
}
681+
645682
/**
646683
* @dataProvider provideEntryPointRequiredData
647684
*/
648-
public function testEntryPointRequired(array $firewall, $messageRegex)
685+
public function testEntryPointRequired(array $firewall, string $messageRegex)
649686
{
650687
$this->expectException(InvalidConfigurationException::class);
651688
$this->expectExceptionMessageMatches($messageRegex);
@@ -664,7 +701,7 @@ public function testEntryPointRequired(array $firewall, $messageRegex)
664701
$container->compile();
665702
}
666703

667-
public static function provideEntryPointRequiredData()
704+
public static function provideEntryPointRequiredData(): iterable
668705
{
669706
// more than one entry point available and not explicitly set
670707
yield [
@@ -695,7 +732,7 @@ public function testConfigureCustomAuthenticator(array $firewall, array $expecte
695732
$this->assertEquals($expectedAuthenticators, array_map('strval', $container->getDefinition('security.authenticator.manager.main')->getArgument(0)));
696733
}
697734

698-
public static function provideConfigureCustomAuthenticatorData()
735+
public static function provideConfigureCustomAuthenticatorData(): iterable
699736
{
700737
yield [
701738
['custom_authenticator' => TestAuthenticator::class],
@@ -772,7 +809,7 @@ public function testUserCheckerWithAuthenticatorManager(array $config, string $e
772809
$this->assertEquals($expectedUserCheckerClass, $container->findDefinition($userCheckerId)->getClass());
773810
}
774811

775-
public static function provideUserCheckerConfig()
812+
public static function provideUserCheckerConfig(): iterable
776813
{
777814
yield [[], InMemoryUserChecker::class];
778815
yield [['user_checker' => TestUserChecker::class], TestUserChecker::class];

Tests/Functional/AuthenticatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testWithoutUserProvider($email)
4545
$this->assertJsonStringEqualsJsonString('{"email":"'.$email.'"}', $client->getResponse()->getContent());
4646
}
4747

48-
public static function provideEmails()
48+
public static function provideEmails(): iterable
4949
{
5050
yield ['[email protected]', true];
5151
yield ['[email protected]', false];
@@ -69,7 +69,7 @@ public function testLoginUsersWithMultipleFirewalls(string $username, string $fi
6969
$this->assertEquals('Welcome '.$username.'!', $client->getResponse()->getContent());
7070
}
7171

72-
public static function provideEmailsWithFirewalls()
72+
public static function provideEmailsWithFirewalls(): iterable
7373
{
7474
yield ['[email protected]', 'main'];
7575
yield ['[email protected]', 'custom'];

Tests/Functional/CsrfFormLoginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function testFormLoginRedirectsToProtectedResourceAfterLogin($options)
122122
$this->assertStringContainsString('You\'re browsing to path "/protected-resource".', $text);
123123
}
124124

125-
public static function provideClientOptions()
125+
public static function provideClientOptions(): iterable
126126
{
127127
yield [['test_case' => 'CsrfFormLogin', 'root_config' => 'config.yml']];
128128
yield [['test_case' => 'CsrfFormLogin', 'root_config' => 'routes_as_path.yml']];

Tests/Functional/FormLoginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function testLoginThrottling()
147147
}
148148
}
149149

150-
public static function provideClientOptions()
150+
public static function provideClientOptions(): iterable
151151
{
152152
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'base_config.yml']];
153153
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'routes_as_path.yml']];

Tests/Functional/RememberMeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testSessionLessRememberMeLogout()
9393
$this->assertNull($cookieJar->get('REMEMBERME'));
9494
}
9595

96-
public static function provideConfigs()
96+
public static function provideConfigs(): iterable
9797
{
9898
yield [['root_config' => 'config_session.yml']];
9999
yield [['root_config' => 'config_persistent.yml']];

Tests/Functional/SecurityRoutingIntegrationTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ public function testInvalidIpsInAccessControl()
125125
$this->expectException(\LogicException::class);
126126
$this->expectExceptionMessage('The given value "256.357.458.559" in the "security.access_control" config option is not a valid IP address.');
127127

128-
$client = $this->createClient(['test_case' => 'StandardFormLogin', 'root_config' => 'invalid_ip_access_control.yml']);
129-
$client->request('GET', '/unprotected_resource');
128+
$this->createClient(['test_case' => 'StandardFormLogin', 'root_config' => 'invalid_ip_access_control.yml']);
130129
}
131130

132131
public function testPublicHomepage()
@@ -151,7 +150,19 @@ private function assertRestricted($client, $path)
151150
$this->assertEquals(302, $client->getResponse()->getStatusCode());
152151
}
153152

154-
public static function provideConfigs()
153+
public static function provideClientOptions(): iterable
154+
{
155+
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'base_config.yml', 'enable_authenticator_manager' => true]];
156+
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'routes_as_path.yml', 'enable_authenticator_manager' => true]];
157+
}
158+
159+
public static function provideLegacyClientOptions()
160+
{
161+
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'base_config.yml', 'enable_authenticator_manager' => true]];
162+
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'routes_as_path.yml', 'enable_authenticator_manager' => true]];
163+
}
164+
165+
public static function provideConfigs(): iterable
155166
{
156167
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'base_config.yml']];
157168
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'routes_as_path.yml']];

Tests/Functional/SecurityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testUserWillBeMarkedAsChangedIfRolesHasChanged(UserInterface $us
7676
$this->assertEquals(302, $client->getResponse()->getStatusCode());
7777
}
7878

79-
public static function userWillBeMarkedAsChangedIfRolesHasChangedProvider()
79+
public static function userWillBeMarkedAsChangedIfRolesHasChangedProvider(): array
8080
{
8181
return [
8282
[

0 commit comments

Comments
 (0)