From 42f065881bbaff3381daa18b1510224aeb6ebb9a Mon Sep 17 00:00:00 2001 From: Willem-Jan Date: Wed, 20 Dec 2023 11:38:07 +0100 Subject: [PATCH] Verify this library is no longer needed --- test/JsonRequestTransformerListenerTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/JsonRequestTransformerListenerTest.php b/test/JsonRequestTransformerListenerTest.php index 6b6292e..490bd7d 100755 --- a/test/JsonRequestTransformerListenerTest.php +++ b/test/JsonRequestTransformerListenerTest.php @@ -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 { @@ -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 [