meetup-raffle-winner-picker/tests/FakeEventRepository.php

25 lines
663 B
PHP
Raw Normal View History

2022-01-13 20:13:28 +00:00
<?php
declare(strict_types=1);
namespace App\Tests;
use App\EventRepository;
use Tightenco\Collect\Support\Collection;
2022-01-13 20:13:28 +00:00
final class FakeEventRepository implements EventRepository
{
public function getConfirmedAttendees(): Collection {
$rsvps = Collection::make([
['name' => 'matthew s.', 'response' => 'yes'],
['name' => 'Michael P.', 'response' => 'yes'],
['name' => 'Kathryn "Kat" R.', 'response' => 'yes'],
2022-01-13 20:40:15 +00:00
['name' => 'Did not attend', 'response' => 'no'],
]);
return $rsvps
->filter(fn (array $attendee): bool => $attendee['response'] == 'yes')
;
2022-01-13 20:13:28 +00:00
}
}