Skip to content

Commit fced11a

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Scheduler] Fix changelog [FrameworkBundle][Test]: add token attributes in `KernelBrowser::loginUser()` Fix stateful scheduler [Scheduler] Speed up tests [HttpClient] Enable using EventSourceHttpClient::connect() for both GET and POST [Serializer] Allow Context to target classes [Validator] Add is_valid function to Expression constraint Fix Form profiler toggles [FrameworkBundle] Fix missing PhraseProviderFactory import [Security] Fixing deprecation message
2 parents c94c571 + abe57a7 commit fced11a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ CHANGELOG
4848
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0
4949
* Deprecate `framework.validation.enable_annotations`, use `framework.validation.enable_attributes` instead
5050
* Deprecate `framework.serializer.enable_annotations`, use `framework.serializer.enable_attributes` instead
51+
* Add `array $tokenAttributes = []` optional parameter to `KernelBrowser::loginUser()`
5152

5253
6.3
5354
---

KernelBrowser.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,15 @@ public function enableReboot(): void
9595
}
9696

9797
/**
98-
* @param UserInterface $user
98+
* @param UserInterface $user
99+
* @param array<string, mixed> $tokenAttributes
99100
*
100101
* @return $this
101102
*/
102-
public function loginUser(object $user, string $firewallContext = 'main'): static
103+
public function loginUser(object $user, string $firewallContext = 'main'/* , array $tokenAttributes = [] */): static
103104
{
105+
$tokenAttributes = 2 < \func_num_args() ? func_get_arg(2) : [];
106+
104107
if (!interface_exists(UserInterface::class)) {
105108
throw new \LogicException(sprintf('"%s" requires symfony/security-core to be installed. Try running "composer require symfony/security-core".', __METHOD__));
106109
}
@@ -110,6 +113,7 @@ public function loginUser(object $user, string $firewallContext = 'main'): stati
110113
}
111114

112115
$token = new TestBrowserToken($user->getRoles(), $user, $firewallContext);
116+
$token->setAttributes($tokenAttributes);
113117

114118
$container = $this->getContainer();
115119
$container->get('security.untracked_token_storage')->setToken($token);

0 commit comments

Comments
 (0)