create(); $response = actingAs($user)->getJson('/api/v1/me')->assertOk(); $json = $response->json(); $collectKeys = function (array $arr) use (&$collectKeys): array { $keys = array_keys($arr); foreach ($arr as $v) { if (is_array($v)) { $keys = array_merge($keys, $collectKeys($v)); } } return $keys; }; expect($collectKeys($json))->not->toContain('id'); expect($json)->toHaveKey('uuid'); });