Files
laravel-manager/tests/Feature/AuditOffTest.php
T
Matthijs Iriks 57f51f9b61
PR CI / flow (pull_request) Successful in 4s
PR CI / ledger (pull_request) Successful in 4s
PR CI / test (stable) (pull_request) Successful in 35s
PR CI / test (lowest) (pull_request) Successful in 40s
PR CI / security (pull_request) Successful in 51s
PR CI / pr-ci (pull_request) Successful in 1s
PR CI / release-automerge (pull_request) Successful in 4s
Audit module: audit log and address bans
2026-12-04 02:32:22 +01:00

26 lines
1009 B
PHP

<?php
use Illuminate\Auth\Events\Failed;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Facades\Schema;
use IriksIT\Manager\Facades\Manager;
use IriksIT\Manager\Tests\TestCase;
uses(TestCase::class);
it('has no audit log, bans, tables or rights unless the site switched it on', function () {
expect(Route::has('manager.audit.index'))->toBeFalse()
->and(Schema::hasTable('manager_audit_logs'))->toBeFalse()
->and(Schema::hasTable('manager_ip_bans'))->toBeFalse()
->and(Manager::permissionValues())->not->toContain('audit.view', 'audit.manage');
// A failed login goes by without a trace, and without a table to write to.
event(new Failed('web', null, ['email' => '[email protected]']));
});
it('does not schedule the prune command when the audit log is off', function () {
$commands = collect(app(Schedule::class)->events())->map(fn ($event) => $event->command)->implode(' ');
expect($commands)->not->toContain('manager:audit-prune');
});