refactor: group fake classes
This commit is contained in:
parent
ae0e0c2437
commit
767c6f2ced
2 changed files with 3 additions and 2 deletions
32
tests/Fake/FakeEventRepository.php
Normal file
32
tests/Fake/FakeEventRepository.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Fake;
|
||||
|
||||
use App\EventRepository;
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
|
||||
final class FakeEventRepository implements EventRepository
|
||||
{
|
||||
private static array $rsvps = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
self::$rsvps = [
|
||||
(object) ['name' => 'Oliver Davies.', 'is_attending' => true, 'is_host' => true],
|
||||
(object) ['name' => 'matthew s.', 'is_attending' => true, 'is_host' => false],
|
||||
(object) ['name' => 'Michael P.', 'is_attending' => true, 'is_host' => false],
|
||||
(object) ['name' => 'Kathryn "Kat" R.', 'is_attending' => true, 'is_host' => false],
|
||||
(object) ['name' => 'Did not attend', 'is_attending' => false, 'is_host' => false],
|
||||
];
|
||||
}
|
||||
|
||||
public function getConfirmedAttendees(): Collection
|
||||
{
|
||||
return Collection::make(self::$rsvps)
|
||||
->filter(fn (\stdClass $attendee): bool => $attendee->is_attending)
|
||||
->filter(fn (\stdClass $attendee): bool => !$attendee->is_host)
|
||||
;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue