fix(auth): update refresh token behavior to be reusable within TTL and add tests for token functionality

This commit is contained in:
hamed
2026-06-28 21:57:42 +03:30
parent c2b47d6396
commit 8705b88270
5 changed files with 77 additions and 9 deletions
+3 -1
View File
@@ -32,7 +32,9 @@ abstract class ApiTestCase extends WebTestCase
*/
protected function createUser(array $roles = ['ROLE_USER'], ?string $mobile = null): User
{
$mobile ??= '0912' . str_pad((string) random_int(0, 9_999_999), 7, '0', STR_PAD_LEFT);
// 9 random digits after 09 (full ^09\d{9}$ space) — db_test is never reset,
// so a narrower space eventually collides on the unique mobile.
$mobile ??= '09' . str_pad((string) random_int(0, 999_999_999), 9, '0', STR_PAD_LEFT);
$user = new User($mobile);
$user->setRoles($roles);
$user->setStatus(1);