create(); $entry->addFlag('no_show'); delete(route('entry-flags.undoNoShow', $entry)) ->assertRedirect(route('home')); actAsAdmin(); /** @noinspection PhpUnhandledExceptionInspection */ delete(route('entry-flags.undoNoShow', $entry)) ->assertSessionHasNoErrors() ->assertSessionHas('success', 'No Show status has been removed for '.$entry->audition->name.' #'.$entry->draw_number.' (ID: '.$entry->id.').') ->assertRedirect(route('entry-flags.noShowSelect')); actAsTab(); /** @noinspection PhpUnhandledExceptionInspection */ delete(route('entry-flags.undoNoShow', $entry)) ->assertSessionHasNoErrors() ->assertSessionHas('success', 'No Show status has been removed for '.$entry->audition->name.' #'.$entry->draw_number.' (ID: '.$entry->id.').') ->assertRedirect(route('entry-flags.noShowSelect')); }); it('will not undo a no-show flag for an entry in a published audition', function () { $entry1 = Entry::factory()->create(); $entry2 = Entry::factory()->create(); $entry1->addFlag('no_show'); $entry2->addFlag('no_show'); $entry1->audition->addFlag('seats_published'); $entry2->audition->addFlag('advancement_published'); actAsAdmin(); delete(route('entry-flags.undoNoShow', $entry1)) ->assertRedirect(route('entry-flags.noShowSelect')) ->assertSessionHas('error', 'Cannot undo a no-show for an entry in an audition where seats are published'); delete(route('entry-flags.undoNoShow', $entry2)) ->assertRedirect(route('entry-flags.noShowSelect')) ->assertSessionHas('error', 'Cannot undo a no-show for an entry in an audition where advancement is published'); }); it('removes a no_show flag to the entry', function () { // Arrange $entry = Entry::factory()->create(); $entry->addFlag('no_show'); // Act & Assert actAsAdmin(); delete(route('entry-flags.undoNoShow', $entry)); expect(Entry::find($entry->id)->hasFlag('no_show'))->toBeFalse(); });