46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Models\Room;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
use function Pest\Laravel\get;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('ignores requests from normal users', function () {
|
|
// Arrange
|
|
actAsNormal();
|
|
get(route('admin.signInSheets.index'))
|
|
->assertRedirect(route('dashboard'))
|
|
->assertSessionHas('error', 'You are not authorized to perform this action');
|
|
});
|
|
it('ignores requests from tabulation users', function () {
|
|
// Arrange
|
|
actAsTab();
|
|
get(route('admin.signInSheets.index'))
|
|
->assertRedirect(route('dashboard'))
|
|
->assertSessionHas('error', 'You are not authorized to perform this action');
|
|
});
|
|
it('ignores requests from guests', function () {
|
|
// Arrange
|
|
get(route('admin.signInSheets.index'))
|
|
->assertRedirect(route('home'));
|
|
});
|
|
it('allows access to admin users', function () {
|
|
// Arrange
|
|
actAsAdmin();
|
|
// Act and Assert
|
|
get(route('admin.signInSheets.index'))
|
|
->assertOk()
|
|
->assertViewIs('admin.print_sign_in_sheets.index')
|
|
->assertSessionHasNoErrors();
|
|
});
|
|
it('shows rooms', function () {
|
|
$room = Room::factory()->create();
|
|
actAsAdmin();
|
|
get(route('admin.signInSheets.index'))
|
|
->assertSee($room->name);
|
|
});
|
|
|
|
// Process the form and print the sheets
|