refactor: move attendees into the fake repository
This commit is contained in:
parent
f192dd720c
commit
7b5da6e46a
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
|
||||
interface EventRepository
|
||||
{
|
||||
public function getConfirmedAttendees(): array;
|
||||
public function getConfirmedAttendees(): Collection;
|
||||
}
|
||||
|
|
|
@ -5,10 +5,15 @@ declare(strict_types=1);
|
|||
namespace App\Tests;
|
||||
|
||||
use App\EventRepository;
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
|
||||
final class FakeEventRepository implements EventRepository
|
||||
{
|
||||
public function getConfirmedAttendees(): array {
|
||||
return [];
|
||||
public function getConfirmedAttendees(): Collection {
|
||||
return Collection::make([
|
||||
['name' => 'matthew s.'],
|
||||
['name' => 'Michael P.'],
|
||||
['name' => 'Kathryn "Kat" R.'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,13 @@
|
|||
namespace App\Tests;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
|
||||
final class FakeEventRepositoryTest extends KernelTestCase
|
||||
{
|
||||
/** @test */
|
||||
public function should_only_return_attendees_with_a_yes_rsvp(): void {
|
||||
$attendees = Collection::make([
|
||||
['name' => 'matthew s.'],
|
||||
['name' => 'Michael P.'],
|
||||
['name' => 'Kathryn "Kat" R.'],
|
||||
]);
|
||||
$repository = new FakeEventRepository();
|
||||
$attendees = $repository->getConfirmedAttendees();
|
||||
|
||||
$this->assertCount(3, $attendees->pluck('name'));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue