Release 2.16 (#4780)

This commit is contained in:
Kevin Papst
2024-05-01 14:24:24 +02:00
committed by GitHub
parent 8f8d228fb3
commit 99c296a751
150 changed files with 2498 additions and 1905 deletions

View File

@@ -120,19 +120,34 @@ abstract class ControllerBaseTest extends WebTestCase
default => null,
};
if ($username === null) {
throw new \Exception('Unknown username: ' . $username);
}
return $this->loginByUsername($username);
}
protected function loginByUsername(string $username): HttpKernelBrowser
{
$client = static::createClient();
if ($username !== null) {
/** @var UserRepository $userRepository */
$userRepository = $this->getPrivateService(UserRepository::class);
$user = $userRepository->findByUsername($username);
if ($user === null) {
throw new \Exception('Unknown user: ' . $username);
}
$client->loginUser($user, 'secured_area');
/** @var UserRepository $userRepository */
$userRepository = $this->getPrivateService(UserRepository::class);
$user = $userRepository->findByUsername($username);
if ($user === null) {
throw new \Exception('Unknown user: ' . $username);
}
$client->loginUser($user, 'secured_area');
return $client;
}
protected function loginUser(User $user): HttpKernelBrowser
{
$client = static::createClient();
$client->loginUser($user, 'secured_area');
return $client;
}