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

Verify this library is no longer needed #65

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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