setUpHasPlanner(); } public function test_planner_can_create_user(): void { $planner = $this->planner; $newUserName = fake()->name; $this->assertDatabaseEmpty(User::class); $this ->actingAs($planner) ->post(route('api.users.create'), [ 'name' => $newUserName, ]) ->assertStatus(200) ->assertJson(fn (AssertableJson $json) => $json ->where('success', true) ->has('payload', fn ($json) => $json ->has('user', fn ($json) => $json ->has('id') ->where('name', $newUserName) ) ) ->where('errors', null) ); } }