42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Sinnbeck\DomAssertions\Asserts\AssertElement;
|
|
use Sinnbeck\DomAssertions\Asserts\AssertForm;
|
|
|
|
use function Pest\Laravel\get;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('responds to only admin and tab users', function () {
|
|
get(route('entry-flags.noShowSelect'))
|
|
->assertRedirect(route('home'));
|
|
actAsAdmin();
|
|
get(route('entry-flags.noShowSelect'))
|
|
->assertOk();
|
|
actAsTab();
|
|
get(route('entry-flags.noShowSelect'))
|
|
->assertOk();
|
|
actAsNormal();
|
|
get(route('entry-flags.noShowSelect'))
|
|
->assertRedirect(route('dashboard'))
|
|
->assertSessionHas('error', 'You are not authorized to perform this action');
|
|
});
|
|
it('has an input for entry_id', function () {
|
|
actAsAdmin();
|
|
get(route('entry-flags.noShowSelect'))
|
|
->assertOk()
|
|
->assertElementExists('#entry_id', function (AssertElement $element) {
|
|
$element->is('input');
|
|
});
|
|
});
|
|
it('submits to entry-flags.confirmNoShow', function () {
|
|
actAsAdmin();
|
|
get(route('entry-flags.noShowSelect'))
|
|
->assertOk()
|
|
->assertFormExists('#entry-select-form', function (AssertForm $form) {
|
|
$form->hasMethod('GET')
|
|
->hasAction(route('entry-flags.confirmNoShow'));
|
|
});
|
|
});
|