refactor: move the repository into a setUp method

This commit is contained in:
Oliver Davies 2022-01-13 21:06:46 +00:00
parent bc747a1f70
commit 9d880841ea

View file

@ -7,12 +7,19 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
final class FakeEventRepositoryTest extends KernelTestCase
{
private EventRepository $repository;
public function setUp(): void
{
self::bootKernel();
$this->repository = static::$container->get(EventRepository::class);
}
/** @test */
public function should_only_return_attendees_with_a_yes_rsvp(): void {
$container = self::bootKernel()->getContainer();
$repository = $container->get(EventRepository::class);
$attendees = $repository->getConfirmedAttendees();
$attendees = $this->repository->getConfirmedAttendees();
$this->assertCount(3, $attendees->pluck('name'));
}