mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
fix userNormalizerTest by adding clock in the construct of UserNormalizer
This commit is contained in:
parent
1ecc825945
commit
4e0d8e4def
@ -25,6 +25,7 @@ use libphonenumber\PhoneNumberUtil;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
|
use Symfony\Component\Clock\MockClock;
|
||||||
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
use Symfony\Component\Serializer\Exception\ExceptionInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
@ -122,7 +123,9 @@ final class UserNormalizerTest extends TestCase
|
|||||||
$userRender = $this->prophesize(UserRender::class);
|
$userRender = $this->prophesize(UserRender::class);
|
||||||
$userRender->renderString(Argument::type(User::class), Argument::type('array'))->willReturn($user ? $user->getLabel() : '');
|
$userRender->renderString(Argument::type(User::class), Argument::type('array'))->willReturn($user ? $user->getLabel() : '');
|
||||||
|
|
||||||
$normalizer = new UserNormalizer($userRender->reveal());
|
$clock = new MockClock(new \DateTimeImmutable('now'));
|
||||||
|
|
||||||
|
$normalizer = new UserNormalizer($userRender->reveal(), $clock);
|
||||||
$normalizer->setNormalizer(new class () implements NormalizerInterface {
|
$normalizer->setNormalizer(new class () implements NormalizerInterface {
|
||||||
public function normalize($object, ?string $format = null, array $context = [])
|
public function normalize($object, ?string $format = null, array $context = [])
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user