From 047bd4b30aec0ca332325a77274cd882aee6c721 Mon Sep 17 00:00:00 2001 From: "evgeny.shichenko" Date: Tue, 25 Feb 2020 17:29:34 +0300 Subject: [PATCH] add serializer bundle v3 --- composer.json | 2 +- tests/unit/Factory/EntityFactoryTest.php | 4 ++-- tests/unit/SymfonyMockTrait.php | 9 +++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 47b0c47..9b3dac8 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "ext-json": "*", "doctrine/doctrine-bundle": "^1.9 || ^2.0", "doctrine/orm": "~2.3", - "jms/serializer-bundle": "^2.4", + "jms/serializer-bundle": "^2.4 || ^3.0", "php-amqplib/php-amqplib": "~2.6", "php-amqplib/rabbitmq-bundle": "~1.14.3", "symfony/config": "^4.1 || ^5.0", diff --git a/tests/unit/Factory/EntityFactoryTest.php b/tests/unit/Factory/EntityFactoryTest.php index 100e4ff..f96d58c 100644 --- a/tests/unit/Factory/EntityFactoryTest.php +++ b/tests/unit/Factory/EntityFactoryTest.php @@ -26,7 +26,7 @@ class EntityFactoryTest extends PHPUnit_Framework_TestCase */ public function testCreateQueue(AbstractJob $job, QueueEntityInterface $expected): void { - $serializer = $this->getJMSSerializer(['serialize']); + $serializer = $this->getJMSSerializer(); $serializer->expects($this->once()) ->method('serialize') ->willReturn('{"id":1}'); @@ -66,7 +66,7 @@ public function testJsonDecodeError(): void $this->expectExceptionCode(4); $this->expectExceptionMessage('json_decode error: Syntax error'); - $serializer = $this->getJMSSerializer(['serialize']); + $serializer = $this->getJMSSerializer(); $serializer->expects($this->once()) ->method('serialize') ->willReturn('abrakadabra'); diff --git a/tests/unit/SymfonyMockTrait.php b/tests/unit/SymfonyMockTrait.php index 9c1d5ee..cd18ddc 100644 --- a/tests/unit/SymfonyMockTrait.php +++ b/tests/unit/SymfonyMockTrait.php @@ -6,6 +6,7 @@ use Doctrine\ORM\EntityManager; use JMS\Serializer\Serializer; +use JMS\Serializer\SerializerInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Output\ConsoleOutput; @@ -53,15 +54,11 @@ protected function getMockLogger(array $methods = []) } /** - * @param array $methods - * * @return Serializer | \PHPUnit_Framework_MockObject_MockObject */ - protected function getJMSSerializer(array $methods = []) + protected function getJMSSerializer() { - return $this->getMockBuilder(Serializer::class) - ->disableOriginalConstructor() - ->setMethods($methods) + return $this->getMockBuilder(SerializerInterface::class) ->getMock(); }