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

Commit

Permalink
Merge pull request #65 from qandidate-labs/verify-same-behaviour
Browse files Browse the repository at this point in the history
Verify this library is no longer needed
  • Loading branch information
wjzijderveld authored Dec 20, 2023
2 parents b230fab + 42f0658 commit c754052
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/JsonRequestTransformerListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Kernel;

class JsonRequestTransformerListenerTest extends TestCase
{
Expand Down Expand Up @@ -46,6 +47,26 @@ public function it_transforms_requests_with_a_json_content_type($contentType)
$this->assertNull($event->getResponse());
}

/**
* @test
*/
public function it_results_in_the_output_as_symfony_payload(): void
{
if (version_compare(Kernel::VERSION, '6.3.0') < 0) {
$this->markTestSkipped('Symfony >= 6.3 specific test');
}

$data = ['foo' => 'bar'];
$request = $this->createRequest('application/json', json_encode($data));
$event = $this->createGetResponseEventMock($request);

$this->listener->onKernelRequest($event);

$this->assertEquals($event->getRequest()->request->get('foo'), $event->getRequest()->getPayload()->get('foo'));
$this->assertEquals($event->getRequest()->request->all(), $event->getRequest()->toArray());
$this->assertNull($event->getResponse());
}

public function jsonContentTypes()
{
return [
Expand Down

0 comments on commit c754052

Please # to comment.