Skip to content

Commit f3ee6de

Browse files
committed
fix tests
1 parent 24aa243 commit f3ee6de

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Tests/Request/RequestBodyParamConverterTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function testApplyWithDefaultSerializerContextExclusionPolicy()
171171

172172
public function testApplyWithSerializerContextOptionsForSymfonySerializer()
173173
{
174-
$this->serializer = $this->getMock('Symfony\Component\Serializer\SerializerInterface');
174+
$this->serializer = $this->getMock('\Symfony\Component\Serializer\Serializer', array('deserialize'));
175175
$this->converter = new RequestBodyParamConverter($this->serializer);
176176
$requestBody = '{"name": "Post 1", "body": "This is a blog post"}';
177177

@@ -193,7 +193,9 @@ public function testApplyWithSerializerContextOptionsForSymfonySerializer()
193193

194194
public function testApplyWithValidationErrors()
195195
{
196-
$validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
196+
$validator = $this->getMockBuilder('Symfony\Component\Validator\Validator')
197+
->disableOriginalConstructor()
198+
->getMock();
197199
$validationErrors = $this->getMock('Symfony\Component\Validator\ConstraintViolationList');
198200

199201
$this->converter = new RequestBodyParamConverter($this->serializer, null, null, $validator, 'validationErrors');
@@ -290,8 +292,10 @@ public function testValidatorOptionsStructureAfterMergeWithUserOptions()
290292
);
291293
$config = $this->createConfiguration(null, null, $userOptions);
292294

293-
$validatorMock = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
294-
$this->converter = new RequestBodyParamConverter($this->serializer, null, null, $validatorMock, 'validationErrors');
295+
$validator = $this->getMockBuilder('Symfony\Component\Validator\Validator')
296+
->disableOriginalConstructor()
297+
->getMock();
298+
$this->converter = new RequestBodyParamConverter($this->serializer, null, null, $validator, 'validationErrors');
295299
$request = $this->createRequest();
296300

297301
$this->converter->apply($request, $config);

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"require-dev": {
3333
"sensio/framework-extra-bundle": "~2.1",
3434
"symfony/form": "~2.1",
35+
"symfony/validator": "~2.1",
3536
"symfony/yaml": "~2.1",
3637
"symfony/security": "~2.1",
3738
"jms/serializer-bundle": "0.12.*"

0 commit comments

Comments
 (0)