26 lines
1009 B
PHP
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');
|
|
});
|