create([ 'status' => 'published', ]); Photo::factory()->create([ 'event_id' => $event->id, 'guest_name' => 'Alex', 'likes_count' => 3, ]); Photo::factory()->create([ 'event_id' => $event->id, 'guest_name' => 'Sam', 'likes_count' => 5, ]); Photo::factory()->create([ 'event_id' => $event->id, 'guest_name' => 'Alex', 'likes_count' => 2, ]); $token = app(EventJoinTokenService::class)->createToken($event, ['label' => 'stats']); $response = $this->getJson('/api/v1/events/'.$token->plain_token.'/stats'); $response->assertOk(); $response->assertJsonPath('guest_count', 2); $response->assertJsonPath('likes_count', 10); } }