mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix tests on PersonContextWithThirdParty: fix construction of PersonContextWithThirdPartyTest
This commit is contained in:
parent
667104a595
commit
847fd71364
@ -27,8 +27,11 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
|||||||
*/
|
*/
|
||||||
class PersonContextWithThirdParty implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface
|
class PersonContextWithThirdParty implements DocGeneratorContextWithAdminFormInterface, DocGeneratorContextWithPublicFormInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly PersonContextInterface $personContext, private readonly NormalizerInterface $normalizer, private readonly ThirdPartyRepository $thirdPartyRepository)
|
public function __construct(
|
||||||
{
|
private readonly PersonContextInterface $personContext,
|
||||||
|
private readonly NormalizerInterface $normalizer,
|
||||||
|
private readonly ThirdPartyRepository $thirdPartyRepository
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
@ -16,6 +16,7 @@ use Chill\PersonBundle\Entity\Person;
|
|||||||
use Chill\PersonBundle\Service\DocGenerator\PersonContextInterface;
|
use Chill\PersonBundle\Service\DocGenerator\PersonContextInterface;
|
||||||
use Chill\PersonBundle\Service\DocGenerator\PersonContextWithThirdParty;
|
use Chill\PersonBundle\Service\DocGenerator\PersonContextWithThirdParty;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
@ -83,9 +84,18 @@ final class PersonContextWithThirdPartyTest extends KernelTestCase
|
|||||||
$personContext->getData(Argument::type(DocGeneratorTemplate::class), Argument::type(Person::class), Argument::type('array'))
|
$personContext->getData(Argument::type(DocGeneratorTemplate::class), Argument::type(Person::class), Argument::type('array'))
|
||||||
->willReturn(['person' => 'data']);
|
->willReturn(['person' => 'data']);
|
||||||
|
|
||||||
|
$thirdPartyRepository = $this->prophesize(ThirdPartyRepository::class);
|
||||||
|
$thirdPartyRepository->find(Argument::type('int'))->willReturn(new class () extends ThirdParty {
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return new PersonContextWithThirdParty(
|
return new PersonContextWithThirdParty(
|
||||||
$personContext->reveal(),
|
$personContext->reveal(),
|
||||||
$normalizer->reveal()
|
$normalizer->reveal(),
|
||||||
|
$thirdPartyRepository->reveal(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user