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

25 lines
666 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
{
private static array $rsvps = [
['name' => 'matthew s.', 'response' => 'yes'],
['name' => 'Michael P.', 'response' => 'yes'],
['name' => 'Kathryn "Kat" R.', 'response' => 'yes'],
['name' => 'Did not attend', 'response' => 'no'],
];
public function getConfirmedAttendees(): Collection {
return Collection::make(self::$rsvps)
->filter(fn (array $attendee): bool => $attendee['response'] == 'yes')
;
2022-01-13 20:13:28 +00:00
}
}