diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php index 88ab41e91..1a5c78d62 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php @@ -33,8 +33,16 @@ use function count; final readonly class CalendarContext implements CalendarContextInterface { - public function __construct(private BaseContextData $baseContextData, private EntityManagerInterface $entityManager, private NormalizerInterface $normalizer, private PersonRender $personRender, private PersonRepository $personRepository, private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper) - { + public function __construct( + private BaseContextData $baseContextData, + private EntityManagerInterface $entityManager, + private NormalizerInterface $normalizer, + private PersonRender $personRender, + private PersonRepository $personRepository, + private ThirdPartyRender $thirdPartyRender, + private ThirdPartyRepository $thirdPartyRepository, + private TranslatableStringHelperInterface $translatableStringHelper + ) { } public function adminFormReverseTransform(array $data): array diff --git a/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php b/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php index cbb4ea3af..7bbaf4ded 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php @@ -19,8 +19,10 @@ use Chill\DocGeneratorBundle\Service\Context\BaseContextData; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Templating\Entity\PersonRender; use Chill\ThirdPartyBundle\Entity\ThirdParty; +use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository; use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; @@ -210,9 +212,15 @@ final class CalendarContextTest extends TestCase $personRender = $this->prophesize(PersonRender::class); $personRender->renderString(Argument::type(Person::class), [])->willReturn('person name'); + $personRepository = $this->prophesize(PersonRepository::class); + $personRepository->find(Argument::type('int'))->willReturn(new Person()); + $thirdPartyRender = $this->prophesize(ThirdPartyRender::class); $thirdPartyRender->renderString(Argument::type(ThirdParty::class), [])->willReturn('third party name'); + $thirdPartyRepository = $this->prophesize(ThirdPartyRepository::class); + $thirdPartyRepository->find(Argument::type('int'))->willReturn(new ThirdParty()); + $translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class); $translatableStringHelper->localize(Argument::type('array'))->willReturn('blabla'); @@ -229,7 +237,9 @@ final class CalendarContextTest extends TestCase $entityManager, $normalizer, $personRender->reveal(), + $personRepository->reveal(), $thirdPartyRender->reveal(), + $thirdPartyRepository->reveal(), $translatableStringHelper->reveal() ); } diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index 39b4dc306..71ae7b5a6 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -22,7 +22,7 @@ use function count; use function in_array; use function str_replace; -final class PersonRepository implements ObjectRepository +class PersonRepository implements ObjectRepository { private readonly EntityRepository $repository;