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

Commit

Permalink
Verify this library is no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
wjzijderveld committed Dec 20, 2023
1 parent b230fab commit 42f0658
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 42f0658

Please # to comment.