Visitor management app with SSO, kiosk, badges, reports, and Gitea CI deploy to frontdesk.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Models\Organization;
|
|
use App\Models\Visitor;
|
|
use App\Services\Frontdesk\WatchlistService;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
use Tests\TestCase;
|
|
|
|
class WatchlistServiceTest extends TestCase
|
|
{
|
|
#[Test]
|
|
public function blacklisted_visitor_is_blocked(): void
|
|
{
|
|
$visitor = new Visitor(['watchlist_status' => Visitor::WATCHLIST_BLACKLISTED]);
|
|
|
|
$this->expectException(HttpException::class);
|
|
app(WatchlistService::class)->assertCanCheckIn($visitor);
|
|
}
|
|
|
|
#[Test]
|
|
public function allowed_visitor_passes_watchlist_check(): void
|
|
{
|
|
$visitor = new Visitor(['watchlist_status' => Visitor::WATCHLIST_ALLOWED]);
|
|
|
|
app(WatchlistService::class)->assertCanCheckIn($visitor);
|
|
$this->assertTrue(true);
|
|
}
|
|
|
|
#[Test]
|
|
public function requires_approval_visitor_is_not_blocked_at_gate(): void
|
|
{
|
|
$visitor = new Visitor(['watchlist_status' => Visitor::WATCHLIST_REQUIRES_APPROVAL]);
|
|
|
|
app(WatchlistService::class)->assertCanCheckIn($visitor);
|
|
$this->assertTrue(app(WatchlistService::class)->visitorNeedsApprovalQueue($visitor));
|
|
}
|
|
}
|