$action())->toThrow( AuditionAdminException::class, 'Only administrators may perform this action' ); actAsNormal(); expect(fn () => $action())->toThrow( AuditionAdminException::class, 'Only administrators may perform this action' ); actAsAdmin(); expect($action->saveSeats())->toBeTrue(); }); it('saves a seated student to the historical table', function () { actAsAdmin(); $entry = Entry::factory()->create(); Entry::factory(5)->create(); $action = new RecordHistoricalSeats(); $ensemble = Ensemble::create([ 'event_id' => $entry->audition->event_id, 'name' => 'Test Ensemble', 'code' => 'te', 'rank' => 1, ]); $seat = Seat::create([ 'ensemble_id' => $ensemble->id, 'audition_id' => $entry->audition_id, 'seat' => '1', 'entry_id' => $entry->id, ]); $action->saveSeats(); $historical_seats = HistoricalSeat::all(); $test_seat = $historical_seats->first(); expect($test_seat->student_id)->toBe($entry->student_id) ->and($historical_seats)->toHaveCount(1) ->and($test_seat->seat_description)->toBe($ensemble->name.' - '.$entry->audition->name.' - '.$seat->seat) ->and(Student::count())->toBe(6); });