Files
eCert-MBIP/database/factories/ProgramFactory.php
Saufi 700fbd1bcc feat: testing suite and bug fixes (Fasa 11)
- AuthTest, ProgramTest, CheckinTest, QuestionnaireTest, CertificateTest — 19 feature tests, 35 total pass
- ProgramFactory with published() state
- UserFactory: is_admin=true default, nonAdmin() state
- Fix attendance_source column name in StatisticsController (was: source)
- Fix route(dashboard) → route(admin.dashboard) in all Breeze auth controllers
- Remove irrelevant Breeze boilerplate tests (Profile, Example, Registration)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 00:23:38 +08:00

31 lines
921 B
PHP

<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ProgramFactory extends Factory
{
public function definition(): array
{
return [
'title' => fake()->sentence(3),
'organizer' => fake()->company(),
'location' => fake()->city(),
'start_date' => now()->toDateString(),
'end_date' => now()->toDateString(),
'status' => 'draft',
'allow_walk_in' => true,
'default_staff_session' => 'pagi',
'default_external_session' => 'pagi',
'created_by' => User::factory(),
];
}
public function published(): static
{
return $this->state(fn () => ['status' => 'published']);
}
}