diff --git a/src/RsvpResponse.php b/src/RsvpResponse.php deleted file mode 100644 index 4d5c6f9..0000000 --- a/src/RsvpResponse.php +++ /dev/null @@ -1,11 +0,0 @@ -repository->getConfirmedAttendees(); - $this->assertCount(3, $attendees); + $this->assertFalse($attendees->pluck('is_attending')->contains(false)); } /** @test */ @@ -21,6 +21,6 @@ trait EventRepositoryContractTest { $attendees = $this->repository->getConfirmedAttendees(); - $this->assertCount(3, $attendees); + $this->assertFalse($attendees->pluck('is_host')->contains(true)); } } diff --git a/tests/FakeEventRepository.php b/tests/FakeEventRepository.php index 50ecee9..b27e696 100644 --- a/tests/FakeEventRepository.php +++ b/tests/FakeEventRepository.php @@ -5,24 +5,22 @@ declare(strict_types=1); namespace App\Tests; use App\EventRepository; -use App\RsvpResponse; use Tightenco\Collect\Support\Collection; final class FakeEventRepository implements EventRepository { private static array $rsvps = [ - ['name' => 'Oliver Davies.', 'response' => RsvpResponse::RESPONSE_YES, 'is_host' => true], - ['name' => 'matthew s.', 'response' => RsvpResponse::RESPONSE_YES, 'is_host' => false], - ['name' => 'Michael P.', 'response' => RsvpResponse::RESPONSE_YES, 'is_host' => false], - ['name' => 'Kathryn "Kat" R.', 'response' => RsvpResponse::RESPONSE_YES, 'is_host' => false], - ['name' => 'Did not attend', 'response' => RsvpResponse::RESPONSE_NO, 'is_host' => false], + ['name' => 'Oliver Davies.', 'is_attending' => true, 'is_host' => true], + ['name' => 'matthew s.', 'is_attending' => true, 'is_host' => false], + ['name' => 'Michael P.', 'is_attending' => true, 'is_host' => false], + ['name' => 'Kathryn "Kat" R.', 'is_attending' => true, 'is_host' => false], + ['name' => 'Did not attend', 'is_attending' => false, 'is_host' => false], ]; public function getConfirmedAttendees(): Collection { return Collection::make(self::$rsvps) - ->filter(fn (array $attendee): bool => $attendee['response'] - == RsvpResponse::RESPONSE_YES) + ->filter(fn (array $attendee): bool => $attendee['is_attending']) ->filter(fn (array $attendee): bool => !$attendee['is_host']) ; }