create(); $organisation = Organisation::factory()->create(); $organisation->users()->attach($user, ['role' => 'org_admin']); Sanctum::actingAs($user); $response = $this->getJson('/api/v1/auth/me'); $response->assertOk() ->assertJsonStructure([ 'success', 'data' => [ 'id', 'name', 'email', 'timezone', 'locale', 'organisations', ], ]); $this->assertCount(1, $response->json('data.organisations')); } public function test_unauthenticated_user_cannot_get_profile(): void { $response = $this->getJson('/api/v1/auth/me'); $response->assertUnauthorized(); } }