mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix loading of CalendarContext in CalendarContextTest. Needs to remove the final from PersonRepository
This commit is contained in:
parent
d1e09d7047
commit
e2d62d5792
@ -33,8 +33,16 @@ use function count;
|
|||||||
|
|
||||||
final readonly class CalendarContext implements CalendarContextInterface
|
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
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
@ -19,8 +19,10 @@ use Chill\DocGeneratorBundle\Service\Context\BaseContextData;
|
|||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Repository\PersonRepository;
|
||||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
@ -210,9 +212,15 @@ final class CalendarContextTest extends TestCase
|
|||||||
$personRender = $this->prophesize(PersonRender::class);
|
$personRender = $this->prophesize(PersonRender::class);
|
||||||
$personRender->renderString(Argument::type(Person::class), [])->willReturn('person name');
|
$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 = $this->prophesize(ThirdPartyRender::class);
|
||||||
$thirdPartyRender->renderString(Argument::type(ThirdParty::class), [])->willReturn('third party name');
|
$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 = $this->prophesize(TranslatableStringHelperInterface::class);
|
||||||
$translatableStringHelper->localize(Argument::type('array'))->willReturn('blabla');
|
$translatableStringHelper->localize(Argument::type('array'))->willReturn('blabla');
|
||||||
|
|
||||||
@ -229,7 +237,9 @@ final class CalendarContextTest extends TestCase
|
|||||||
$entityManager,
|
$entityManager,
|
||||||
$normalizer,
|
$normalizer,
|
||||||
$personRender->reveal(),
|
$personRender->reveal(),
|
||||||
|
$personRepository->reveal(),
|
||||||
$thirdPartyRender->reveal(),
|
$thirdPartyRender->reveal(),
|
||||||
|
$thirdPartyRepository->reveal(),
|
||||||
$translatableStringHelper->reveal()
|
$translatableStringHelper->reveal()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ use function count;
|
|||||||
use function in_array;
|
use function in_array;
|
||||||
use function str_replace;
|
use function str_replace;
|
||||||
|
|
||||||
final class PersonRepository implements ObjectRepository
|
class PersonRepository implements ObjectRepository
|
||||||
{
|
{
|
||||||
private readonly EntityRepository $repository;
|
private readonly EntityRepository $repository;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user