refactor: get the repository from the container

This commit is contained in:
Oliver Davies 2022-01-13 21:02:13 +00:00
parent 78841ad9d6
commit bc747a1f70
3 changed files with 17 additions and 6 deletions

View file

@ -2,13 +2,16 @@
namespace App\Tests;
use App\EventRepository;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
final class FakeEventRepositoryTest extends KernelTestCase
{
/** @test */
public function should_only_return_attendees_with_a_yes_rsvp(): void {
$repository = new FakeEventRepository();
$container = self::bootKernel()->getContainer();
$repository = $container->get(EventRepository::class);
$attendees = $repository->getConfirmedAttendees();
$this->assertCount(3, $attendees->pluck('name'));