29 lines
885 B
PHP
29 lines
885 B
PHP
<?php
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('denies access to guests and non administrators', function () {
|
|
$this->get(route('admin.bonus-scores.index'))
|
|
->assertRedirect(route('home'));
|
|
|
|
actAsNormal();
|
|
$this->get(route('admin.bonus-scores.index'))
|
|
->assertRedirect(route('dashboard'))
|
|
->assertSessionHas('error', 'You are not authorized to perform this action');
|
|
|
|
actAsTab();
|
|
$this->get(route('admin.bonus-scores.index'))
|
|
->assertRedirect(route('dashboard'))
|
|
->assertSessionHas('error', 'You are not authorized to perform this action');
|
|
});
|
|
it('grants access to an administrator', function () {
|
|
// Arrange
|
|
actAsAdmin();
|
|
// Act & Assert
|
|
$this->get(route('admin.bonus-scores.index'))
|
|
->assertOk()
|
|
->assertViewIs('admin.bonus-scores.index');
|
|
});
|