create([ 'role' => UserRole::ADMIN, ]); $hunt = Hunts::withoutSyncingToSearch(fn () => Hunts::factory()->create([ 'creator_id' => $admin->id, ])); $participant = User::factory()->create(); $hunt->participants()->attach($participant->id); $this->actingAs($admin); Livewire::test(ParticipantsRelationManager::class, [ 'ownerRecord' => $hunt, 'pageClass' => EditHunts::class, ]) ->assertTableActionExists('detach', record: $participant->getKey()) ->assertTableActionDoesNotExist('delete', record: $participant->getKey()) ->callTableAction('detach', $participant->getKey()); $this->assertDatabaseHas('users', [ 'id' => $participant->id, ]); $this->assertDatabaseMissing('hunt_participants', [ 'hunt_id' => $hunt->id, 'user_id' => $participant->id, ]); });