From b161ceeffb9da6c821b1ca18e243d62766dc7ad6 Mon Sep 17 00:00:00 2001 From: soyuka Date: Mon, 13 May 2024 09:51:05 +0200 Subject: [PATCH] test: PATCH on controller w/ dto --- features/main/patch.feature | 5 ++++- .../Issue6355/UpdateOrderProductCountController.php | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/features/main/patch.feature b/features/main/patch.feature index 96ce6653fd..96643220c1 100644 --- a/features/main/patch.feature +++ b/features/main/patch.feature @@ -81,6 +81,7 @@ Feature: Sending PATCH requets } """ + @controller Scenario: Patch a non-readable resource When I add "Content-Type" header equal to "application/merge-patch+json" And I send a "PATCH" request to "/order_products/1/count" with body: @@ -89,5 +90,7 @@ Feature: Sending PATCH requets "id": 1, "count": 10 } + """ - Then print last JSON response + Then the response status code should be 200 + And the JSON node "id" should contain "1" diff --git a/tests/Fixtures/TestBundle/Controller/Issue6355/UpdateOrderProductCountController.php b/tests/Fixtures/TestBundle/Controller/Issue6355/UpdateOrderProductCountController.php index 1f96f0390d..6bd5491990 100644 --- a/tests/Fixtures/TestBundle/Controller/Issue6355/UpdateOrderProductCountController.php +++ b/tests/Fixtures/TestBundle/Controller/Issue6355/UpdateOrderProductCountController.php @@ -14,7 +14,6 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Controller\Issue6355; use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6355\OrderDto; -use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6355\OrderProductCount; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Attribute\AsController; @@ -22,7 +21,7 @@ #[AsController] class UpdateOrderProductCountController extends AbstractController { - public function __invoke(OrderProductCount $data, Request $request): OrderDto + public function __invoke(OrderDto $data, Request $request): OrderDto { $dto = new OrderDto(); $dto->id = 1;