Skip to content

Commit 35a7e5c

Browse files
OskarStarknicolas-grekas
authored andcommitted
[Tests] Streamline
1 parent 773515c commit 35a7e5c

File tree

8 files changed

+16
-17
lines changed

8 files changed

+16
-17
lines changed

Tests/DataCollector/SecurityDataCollectorTest.php

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

403-
public static function provideRoles()
403+
public static function provideRoles(): array
404404
{
405405
return [
406406
// Basic roles

Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public function testSecretRememberMeHandler()
526526
$this->assertSame('very', $handler->getArgument(1));
527527
}
528528

529-
public static function sessionConfigurationProvider()
529+
public static function sessionConfigurationProvider(): array
530530
{
531531
return [
532532
[
@@ -659,7 +659,7 @@ public function testAuthenticatorManagerEnabledEntryPoint(array $firewall, $entr
659659
$this->assertEquals($entryPointId, (string) $container->getDefinition('security.exception_listener.main')->getArgument(4));
660660
}
661661

662-
public static function provideEntryPointFirewalls()
662+
public static function provideEntryPointFirewalls(): iterable
663663
{
664664
// only one entry point available
665665
yield [['http_basic' => true], 'security.authenticator.http_basic.main'];
@@ -679,7 +679,7 @@ public static function provideEntryPointFirewalls()
679679
/**
680680
* @dataProvider provideEntryPointRequiredData
681681
*/
682-
public function testEntryPointRequired(array $firewall, $messageRegex)
682+
public function testEntryPointRequired(array $firewall, string $messageRegex)
683683
{
684684
$this->expectException(InvalidConfigurationException::class);
685685
$this->expectExceptionMessageMatches($messageRegex);
@@ -699,7 +699,7 @@ public function testEntryPointRequired(array $firewall, $messageRegex)
699699
$container->compile();
700700
}
701701

702-
public static function provideEntryPointRequiredData()
702+
public static function provideEntryPointRequiredData(): iterable
703703
{
704704
// more than one entry point available and not explicitly set
705705
yield [
@@ -749,7 +749,7 @@ public function testConfigureCustomAuthenticator(array $firewall, array $expecte
749749
$this->assertEquals($expectedAuthenticators, array_map('strval', $container->getDefinition('security.authenticator.manager.main')->getArgument(0)));
750750
}
751751

752-
public static function provideConfigureCustomAuthenticatorData()
752+
public static function provideConfigureCustomAuthenticatorData(): iterable
753753
{
754754
yield [
755755
['custom_authenticator' => TestAuthenticator::class],
@@ -829,7 +829,7 @@ public function testUserCheckerWithAuthenticatorManager(array $config, string $e
829829
$this->assertEquals($expectedUserCheckerClass, $container->findDefinition($userCheckerId)->getClass());
830830
}
831831

832-
public static function provideUserCheckerConfig()
832+
public static function provideUserCheckerConfig(): iterable
833833
{
834834
yield [[], InMemoryUserChecker::class];
835835
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
@@ -60,7 +60,7 @@ public function testWithoutUserProvider($email)
6060
$this->assertJsonStringEqualsJsonString('{"email":"'.$email.'"}', $client->getResponse()->getContent());
6161
}
6262

63-
public static function provideEmails()
63+
public static function provideEmails(): iterable
6464
{
6565
yield ['[email protected]', true];
6666
yield ['[email protected]', false];
@@ -84,7 +84,7 @@ public function testLoginUsersWithMultipleFirewalls(string $username, string $fi
8484
$this->assertEquals('Welcome '.$username.'!', $client->getResponse()->getContent());
8585
}
8686

87-
public static function provideEmailsWithFirewalls()
87+
public static function provideEmailsWithFirewalls(): iterable
8888
{
8989
yield ['[email protected]', 'main'];
9090
yield ['[email protected]', 'custom'];

Tests/Functional/CsrfFormLoginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function testLegacyFormLoginRedirectsToProtectedResourceAfterLogin($optio
217217
$this->assertStringContainsString('You\'re browsing to path "/protected-resource".', $text);
218218
}
219219

220-
public static function provideClientOptions()
220+
public static function provideClientOptions(): iterable
221221
{
222222
yield [['test_case' => 'CsrfFormLogin', 'root_config' => 'config.yml', 'enable_authenticator_manager' => true]];
223223
yield [['test_case' => 'CsrfFormLogin', 'root_config' => 'routes_as_path.yml', 'enable_authenticator_manager' => true]];

Tests/Functional/FormLoginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testLegacyLoginThrottling()
300300
}
301301
}
302302

303-
public static function provideClientOptions()
303+
public static function provideClientOptions(): iterable
304304
{
305305
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'base_config.yml', 'enable_authenticator_manager' => true]];
306306
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'routes_as_path.yml', 'enable_authenticator_manager' => true]];

Tests/Functional/RememberMeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testLegacySessionLessRememberMeLogout()
175175
$this->assertNull($cookieJar->get('REMEMBERME'));
176176
}
177177

178-
public static function provideConfigs()
178+
public static function provideConfigs(): iterable
179179
{
180180
yield [['root_config' => 'config_session.yml']];
181181
yield [['root_config' => 'config_persistent.yml']];

Tests/Functional/SecurityRoutingIntegrationTest.php

Lines changed: 3 additions & 4 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()
@@ -295,7 +294,7 @@ private function assertRestricted($client, $path)
295294
$this->assertEquals(302, $client->getResponse()->getStatusCode());
296295
}
297296

298-
public static function provideClientOptions()
297+
public static function provideClientOptions(): iterable
299298
{
300299
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'base_config.yml', 'enable_authenticator_manager' => true]];
301300
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'routes_as_path.yml', 'enable_authenticator_manager' => true]];
@@ -307,7 +306,7 @@ public static function provideLegacyClientOptions()
307306
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'routes_as_path.yml', 'enable_authenticator_manager' => true]];
308307
}
309308

310-
public static function provideConfigs()
309+
public static function provideConfigs(): iterable
311310
{
312311
yield [['test_case' => 'StandardFormLogin', 'root_config' => 'base_config.yml']];
313312
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
@@ -114,7 +114,7 @@ public function testLegacyServiceIsFunctional()
114114
$this->assertSame($token, $security->getToken());
115115
}
116116

117-
public static function userWillBeMarkedAsChangedIfRolesHasChangedProvider()
117+
public static function userWillBeMarkedAsChangedIfRolesHasChangedProvider(): array
118118
{
119119
return [
120120
[

0 commit comments

Comments
 (0)