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 e43b696
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
],
"require": {
"symfony/http-kernel": "^4.4.49||^5.4.16||^6.0.16"
"symfony/http-kernel": "^4.4.49||^5.4.16||^6.0.16||^7.0"
},
"autoload": {
"psr-4": {
Expand Down
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 e43b696

Please sign in to comment.