planner; $user = User::factory()->planner($planner)->create(); $this ->actingAs($planner) ->delete(route('api.users.delete', $user)) ->assertStatus(201) ->assertJson(fn (AssertableJson $json) => $json ->where('success', true) ->where('payload', null) ->where('errors', null) ); } public function test_planner_cannot_update_user_of_other_planner(): void { $planner = $this->planner; $otherPlanner = Planner::factory()->create(); $newUserName = fake()->name; $user = User::factory()->planner($otherPlanner)->create(); $this ->actingAs($planner) ->put(route('api.users.update', $user), [ 'name' => $newUserName, ]) ->assertStatus(404) ->assertJson(fn (AssertableJson $json) => $json ->where('success', false) ->where('payload', null) ->where('errors', ["MODEL_NOT_FOUND"]) ); } }