Skip to content

Commit cc97448

Browse files
committed
feat: add phone and is_active fields to user factory and update auth guard in tests
1 parent cbdb037 commit cc97448

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

database/factories/UserFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public function definition(): array
2828
'email' => fake()->unique()->safeEmail(),
2929
'email_verified_at' => now(),
3030
'password' => static::$password ??= Hash::make('password'),
31+
'phone' => fake()->numerify('11#########'),
32+
'is_active' => true,
3133
'remember_token' => Str::random(10),
3234
];
3335
}

tests/Feature/AuthTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function test_authenticated_user_can_logout(): void
8585
{
8686
$user = User::factory()->create();
8787
$user->assignRole('user');
88-
$token = auth()->login($user);
88+
$token = auth('api')->login($user);
8989

9090
$response = $this->withHeader('Authorization', "Bearer $token")
9191
->postJson('/api/v1/auth/logout');
@@ -98,7 +98,7 @@ public function test_authenticated_user_can_refresh_token(): void
9898
{
9999
$user = User::factory()->create();
100100
$user->assignRole('user');
101-
$token = auth()->login($user);
101+
$token = auth('api')->login($user);
102102

103103
$response = $this->withHeader('Authorization', "Bearer $token")
104104
->postJson('/api/v1/auth/refresh');

0 commit comments

Comments
 (0)