feat: add OtpCodeFactory and comprehensive tests for AuthService and RegistrationService

This commit is contained in:
2026-09-21 05:06:46 +03:30
parent 9718fb8c7c
commit fd0d445b6e
8 changed files with 447 additions and 6 deletions
+27
View File
@@ -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(),
]);
}
}