32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
use App\Actions\YearEndProcedures\YearEndCleanup;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('denies access to a non-admin user', function () {
|
|
actAsNormal();
|
|
$response = $this->get(route('admin.year_end_procedures'));
|
|
$response->assertRedirect(route('dashboard'));
|
|
});
|
|
|
|
it('shows options for year end reset', function () {
|
|
actAsAdmin();
|
|
$response = $this->get(route('admin.year_end_procedures'));
|
|
$response->assertOk()
|
|
->assertViewIs('admin.year_end_reset')
|
|
->assertSee('removeAuditionsFromRoom')
|
|
->assertSee('unassignJudges');
|
|
});
|
|
|
|
it('calls the YearEndCleanup action', function () {
|
|
$mock = Mockery::mock(YearEndCleanup::class);
|
|
$mock->shouldReceive('__invoke')->once();
|
|
app()->instance(YearEndCleanup::class, $mock);
|
|
actAsAdmin();
|
|
$response = $this->post(route('admin.year_end_procedures'));
|
|
$response->assertRedirect(route('dashboard'))
|
|
->with('success', 'Year end cleanup completed. ');
|
|
});
|