feat: add OtpCodeFactory and comprehensive tests for AuthService and RegistrationService
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\OtpCode>
|
||||
*/
|
||||
class OtpCodeFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'phone' => '09' . fake()->numerify('#########'),
|
||||
'code' => (string) fake()->numberBetween(1000, 9999),
|
||||
'expires_at' => now()->addMinutes(3),
|
||||
];
|
||||
}
|
||||
|
||||
public function expired(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'expires_at' => now()->subMinute(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user