actingAsForApi(User::factory()->create()) ->postJson(route('api.departments.store')) ->assertForbidden(); } public function testCannotCreateNewLocationsWithTheSameName() { $location = Location::factory()->create(); $location2 = Location::factory()->create(); $this->actingAsForApi(User::factory()->superuser()->create()) ->patchJson(route('api.locations.update', $location2), [ 'name' => $location->name, ]) ->assertOk() ->assertStatusMessageIs('error') ->assertStatus(200) ->json(); } }