From 6a82fccecdea9294a5f0d6ed0389d03810f1fbcc Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 13 Jan 2022 20:45:17 +0000 Subject: [PATCH] fix: filter any 'no' RSVPs from the attendees --- tests/FakeEventRepository.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/FakeEventRepository.php b/tests/FakeEventRepository.php index 759207a..f082305 100644 --- a/tests/FakeEventRepository.php +++ b/tests/FakeEventRepository.php @@ -10,11 +10,15 @@ use Tightenco\Collect\Support\Collection; final class FakeEventRepository implements EventRepository { public function getConfirmedAttendees(): Collection { - return Collection::make([ + $rsvps = Collection::make([ ['name' => 'matthew s.', 'response' => 'yes'], ['name' => 'Michael P.', 'response' => 'yes'], ['name' => 'Kathryn "Kat" R.', 'response' => 'yes'], ['name' => 'Did not attend', 'response' => 'no'], ]); + + return $rsvps + ->filter(fn (array $attendee): bool => $attendee['response'] == 'yes') + ; } }