refactor: move the repository into a setUp method
This commit is contained in:
parent
bc747a1f70
commit
9d880841ea
|
@ -7,12 +7,19 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
final class FakeEventRepositoryTest extends KernelTestCase
|
final class FakeEventRepositoryTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
private EventRepository $repository;
|
||||||
|
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$this->repository = static::$container->get(EventRepository::class);
|
||||||
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function should_only_return_attendees_with_a_yes_rsvp(): void {
|
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'));
|
$this->assertCount(3, $attendees->pluck('name'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue