Files
ladill-frontdesk/tests/Feature/FrontdeskPhase9Test.php
T
isaaccladandCursor 9e2d79936c
Deploy Ladill Frontdesk / deploy (push) Failing after 35s
Test / test (push) Failing after 2m45s
Initial Ladill Frontdesk release with deploy pipeline.
Visitor management app with SSO, kiosk, badges, reports, and Gitea CI deploy to frontdesk.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 20:37:15 +00:00

105 lines
3.0 KiB
PHP

<?php
namespace Tests\Feature;
use App\Http\Middleware\EnsurePlatformSession;
use App\Models\Branch;
use App\Models\Member;
use App\Models\Organization;
use App\Models\User;
use App\Models\Visit;
use App\Models\Visitor;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class FrontdeskPhase9Test extends TestCase
{
use RefreshDatabase;
protected User $user;
protected Organization $organization;
protected function setUp(): void
{
parent::setUp();
$this->withoutMiddleware(EnsurePlatformSession::class);
$this->user = User::create([
'public_id' => 'phase9-user-001',
'name' => 'Phase9 User',
'email' => 'phase9@example.com',
]);
$this->organization = Organization::create([
'owner_ref' => $this->user->public_id,
'name' => 'Phase9 Org',
'slug' => 'phase9-org',
'settings' => ['onboarded' => true, 'badge_expiry_hours' => 8],
]);
Member::create([
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'user_ref' => $this->user->public_id,
'role' => 'org_admin',
]);
Branch::create([
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'name' => 'HQ',
'is_active' => true,
]);
}
public function test_reports_page_loads_with_summary(): void
{
$visitor = Visitor::create([
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'full_name' => 'Report Guest',
'is_frequent' => true,
'visit_count' => 6,
]);
Visit::create([
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'visitor_id' => $visitor->id,
'visitor_type' => 'visitor',
'status' => Visit::STATUS_CHECKED_IN,
'checked_in_at' => now(),
'checked_out_at' => now()->addHour(),
'badge_code' => 'RPT1',
'qr_token' => 'rpt-token',
'badge_expires_at' => now()->addHours(8),
]);
$this->actingAs($this->user)
->get(route('frontdesk.reports.index'))
->assertOk()
->assertSee('Reports')
->assertSee('Report Guest');
}
public function test_reports_can_export_csv(): void
{
$this->actingAs($this->user)
->get(route('frontdesk.reports.export'))
->assertOk()
->assertHeader('content-type', 'text/csv; charset=UTF-8');
}
public function test_daily_report_command_runs(): void
{
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
'report_daily_recipients' => ['admin@example.com'],
]),
]);
$this->artisan('frontdesk:send-daily-reports')->assertSuccessful();
}
}