Skip to content

Commit

Permalink
minor #2243 fix RequestBodyParamConverter tests (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x branch.

Discussion
----------

fix RequestBodyParamConverter tests

Commits
-------

6e485c0 fix RequestBodyParamConverter tests
  • Loading branch information
xabbuh committed Jun 16, 2020
2 parents 0ab98c5 + 6e485c0 commit 0689da4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Tests/Request/RequestBodyParamConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function testRequestAttribute()
->expects($this->once())
->method('deserialize')
->willReturn('Object');
$request = $this->createRequest();
$request = $this->createRequest(null, 'application/json');
$this->launchExecution($converter, $request);
$this->assertEquals('Object', $request->attributes->get('foo'));
}
Expand All @@ -159,7 +159,7 @@ public function testValidatorParameters()

$converter = new RequestBodyParamConverter($this->serializer, null, null, $validator, 'errors');

$request = $this->createRequest();
$request = $this->createRequest(null, 'application/json');
$configuration = $this->createConfiguration(null, null, ['validator' => ['groups' => ['foo']]]);
$this->launchExecution($converter, $request, $configuration);
$this->assertEquals('fooError', $request->attributes->get('errors'));
Expand All @@ -179,7 +179,7 @@ public function testValidatorSkipping()

$converter = new RequestBodyParamConverter($this->serializer, null, null, $validator, 'errors');

$request = $this->createRequest();
$request = $this->createRequest(null, 'application/json');
$configuration = $this->createConfiguration(null, null, ['validate' => false]);
$this->launchExecution($converter, $request, $configuration);
$this->assertNull($request->attributes->get('errors'));
Expand Down Expand Up @@ -277,7 +277,6 @@ public function testNoContentTypeCausesUnsupportedMediaTypeException()
{
$converter = new RequestBodyParamConverter($this->serializer);
$request = $this->createRequest();
$request->headers->remove('CONTENT_TYPE');
$this->expectException(UnsupportedMediaTypeHttpException::class);
$this->launchExecution($converter, $request);
}
Expand Down

0 comments on commit 0689da4

Please sign in to comment.