47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
use App\Models\Certificate;
|
|
use App\Models\SecurityEvent;
|
|
use App\Models\Site;
|
|
use App\Models\User;
|
|
use function Pest\Laravel\actingAs;
|
|
use function Pest\Laravel\get;
|
|
|
|
it('redirects guests to login', function () {
|
|
get(route('security.index'))->assertRedirect(route('login'));
|
|
});
|
|
|
|
it('renders security page chrome', function () {
|
|
$user = User::factory()->create(['email_verified_at' => now()]);
|
|
|
|
actingAs($user)->get(route('security.index'))
|
|
->assertStatus(200)
|
|
->assertSeeText('Sicherheit')
|
|
->assertSeeText('Blockiert / 24h')
|
|
->assertSeeText('Firewall Rules')
|
|
->assertSeeText('SSL läuft bald ab')
|
|
->assertSeeText('2FA Coverage')
|
|
->assertSeeText('Threat Feed')
|
|
->assertSeeText('SSL Zertifikate');
|
|
});
|
|
|
|
it('lists security events and certs', function () {
|
|
$user = User::factory()->create(['email_verified_at' => now()]);
|
|
$site = Site::factory()->create();
|
|
|
|
SecurityEvent::factory()->critical()->create([
|
|
'site_id' => $site->id,
|
|
'message' => 'CRIT-EVT-XYZ',
|
|
'occurred_at' => now()->subMinutes(5),
|
|
]);
|
|
Certificate::factory()->create([
|
|
'site_id' => $site->id,
|
|
'domain' => 'cert-watchme.de',
|
|
]);
|
|
|
|
actingAs($user)->get(route('security.index'))
|
|
->assertStatus(200)
|
|
->assertSeeText('CRIT-EVT-XYZ')
|
|
->assertSeeText('cert-watchme.de');
|
|
});
|