Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Commit

Permalink
add serializer bundle v3
Browse files Browse the repository at this point in the history
  • Loading branch information
medliii authored and Tekill committed Feb 28, 2020
1 parent 5773ddd commit 047bd4b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Factory/EntityFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
Expand Down Expand Up @@ -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');
Expand Down
9 changes: 3 additions & 6 deletions tests/unit/SymfonyMockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 047bd4b

Please sign in to comment.