2022-01-13 20:13:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Tests;
|
|
|
|
|
|
|
|
use App\EventRepository;
|
2022-01-13 20:36:10 +00:00
|
|
|
use Tightenco\Collect\Support\Collection;
|
2022-01-13 20:13:28 +00:00
|
|
|
|
|
|
|
final class FakeEventRepository implements EventRepository
|
|
|
|
{
|
2022-01-13 20:51:14 +00:00
|
|
|
private static array $rsvps = [
|
2022-01-13 23:06:25 +00:00
|
|
|
['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],
|
2022-01-13 20:51:14 +00:00
|
|
|
];
|
2022-01-13 20:45:17 +00:00
|
|
|
|
2022-01-13 21:43:23 +00:00
|
|
|
public function getConfirmedAttendees(): Collection
|
|
|
|
{
|
2022-01-13 20:51:14 +00:00
|
|
|
return Collection::make(self::$rsvps)
|
2022-01-13 23:06:25 +00:00
|
|
|
->filter(fn (array $attendee): bool => $attendee['is_attending'])
|
2022-01-13 21:41:27 +00:00
|
|
|
->filter(fn (array $attendee): bool => !$attendee['is_host'])
|
2022-01-13 20:45:17 +00:00
|
|
|
;
|
2022-01-13 20:13:28 +00:00
|
|
|
}
|
|
|
|
}
|