[3.0] Update Symfony to 7.4 and dependencies, removed deprecated code, removed API password (#5622)
* deactivate deprecated auto-mapping * use native month-picker with fallback on old browser * bump dependencies to new major versions * replace deprecated ARRAY column type with JSON * named arguments * nullable arguments * native lazy ghosts * update routes to use php config * disable PHP < 8.4 * use static RTL configuration * new qr code package * clear out env file * recipe updates * fix deprecations * preset new env variable if not existing * bump maria db version examples * remove deprecated api-token support * fix validator deprecations * remove timesheet category column * fix broken validator autoconfiguration * stabilize tests * fix migration syntax compatibility * fix doctrine deprecation * fix datetime format * remove constructor dependency * only include visible preferences in invoice templates * fix test container dependency * removed ProjectConstraint multi-constraint logic * allow to disable plugins in certain environments * refactor TimesheetConstraint to non-service * activate new interface methods * prevent update issues with .env * improved customer fixture * removed $user->isExportDecimal()
This commit is contained in:
@@ -242,7 +242,7 @@ class ProfileControllerTest extends AbstractControllerBaseTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testCreateApiToken(): void
|
||||
public function testCreateAccessToken(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
@@ -283,61 +283,6 @@ class ProfileControllerTest extends AbstractControllerBaseTestCase
|
||||
self::assertEquals($code->innerText(), $tokens[1]->getToken());
|
||||
}
|
||||
|
||||
#[Group('legacy')]
|
||||
public function testCreateApiPassword(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->request($client, '/profile/' . UserFixtures::USERNAME_USER . '/api-token');
|
||||
|
||||
$user = $this->getUserByRole(User::ROLE_USER);
|
||||
/** @var PasswordHasherFactoryInterface $passwordEncoder */
|
||||
$passwordEncoder = self::getContainer()->get('security.password_hasher_factory');
|
||||
|
||||
self::assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), UserFixtures::DEFAULT_API_TOKEN));
|
||||
self::assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), 'test1234'));
|
||||
self::assertEquals(UserFixtures::USERNAME_USER, $user->getUserIdentifier());
|
||||
|
||||
$form = $client->getCrawler()->filter('form[name=user_api_password]')->form();
|
||||
$client->submit($form, [
|
||||
'user_api_password' => [
|
||||
'plainApiToken' => [
|
||||
'first' => 'test1234',
|
||||
'second' => 'test1234',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/api-token'));
|
||||
$client->followRedirect();
|
||||
self::assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$this->assertHasFlashSuccess($client);
|
||||
|
||||
$user = $this->getUserByRole(User::ROLE_USER);
|
||||
|
||||
self::assertFalse($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), UserFixtures::DEFAULT_API_TOKEN));
|
||||
self::assertTrue($passwordEncoder->getPasswordHasher($user)->verify($user->getApiToken(), 'test1234'));
|
||||
}
|
||||
|
||||
#[Group('legacy')]
|
||||
public function testCreateApiPasswordFailsIfPasswordLengthToShort(): void
|
||||
{
|
||||
$this->assertFormHasValidationError(
|
||||
User::ROLE_USER,
|
||||
'/profile/' . UserFixtures::USERNAME_USER . '/api-token',
|
||||
'form[name=user_api_password]',
|
||||
[
|
||||
'user_api_password' => [
|
||||
'plainApiToken' => [
|
||||
'first' => 'abcdef1',
|
||||
'second' => 'abcdef1',
|
||||
]
|
||||
]
|
||||
],
|
||||
['#user_api_password_plainApiToken_first']
|
||||
);
|
||||
}
|
||||
|
||||
public function testRolesActionIsSecured(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
@@ -602,13 +547,13 @@ class ProfileControllerTest extends AbstractControllerBaseTestCase
|
||||
$form = $client->getCrawler()->filter('form[name=user_contract]')->form();
|
||||
|
||||
$client->submit($form, [
|
||||
'user_contract[workHoursMonday]' => '1:00',
|
||||
'user_contract[workHoursTuesday]' => '2:00',
|
||||
'user_contract[workHoursWednesday]' => '3:00',
|
||||
'user_contract[workHoursThursday]' => '4:30',
|
||||
'user_contract[workHoursFriday]' => '5:12',
|
||||
'user_contract[workHoursSaturday]' => '6:59',
|
||||
'user_contract[workHoursSunday]' => '0:01',
|
||||
'user_contract[work_monday]' => '1:00',
|
||||
'user_contract[work_tuesday]' => '2:00',
|
||||
'user_contract[work_wednesday]' => '3:00',
|
||||
'user_contract[work_thursday]' => '4:30',
|
||||
'user_contract[work_friday]' => '5:12',
|
||||
'user_contract[work_saturday]' => '6:59',
|
||||
'user_contract[work_sunday]' => '0:01',
|
||||
]);
|
||||
|
||||
$this->assertIsRedirect($client, $this->createUrl('/profile/' . urlencode(UserFixtures::USERNAME_USER) . '/contract'));
|
||||
|
||||
Reference in New Issue
Block a user