create(['name' => 'Open', 'slug' => 'open', 'color' => 'blue']); Priority::query()->create(['name' => 'Normal', 'slug' => 'normal', 'color' => 'blue']); $user = User::factory()->create(); Livewire::actingAs($user) ->test(TicketCreate::class) ->set('subject', 'Printer is not working') ->set('body', 'The office printer is showing an error code and will not print.') ->set('priority_id', Priority::query()->firstOrFail()->id) ->call('save') ->assertHasNoErrors(); $this->assertDatabaseHas('helpdesk_tickets', [ 'subject' => 'Printer is not working', 'user_id' => $user->id, ]); } }