Skip to content

Commit b161cee

Browse files
committed
test: PATCH on controller w/ dto
1 parent 59dca65 commit b161cee

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

features/main/patch.feature

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Feature: Sending PATCH requets
8181
}
8282
"""
8383

84+
@controller
8485
Scenario: Patch a non-readable resource
8586
When I add "Content-Type" header equal to "application/merge-patch+json"
8687
And I send a "PATCH" request to "/order_products/1/count" with body:
@@ -89,5 +90,7 @@ Feature: Sending PATCH requets
8990
"id": 1,
9091
"count": 10
9192
}
93+
9294
"""
93-
Then print last JSON response
95+
Then the response status code should be 200
96+
And the JSON node "id" should contain "1"

tests/Fixtures/TestBundle/Controller/Issue6355/UpdateOrderProductCountController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
namespace ApiPlatform\Tests\Fixtures\TestBundle\Controller\Issue6355;
1515

1616
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6355\OrderDto;
17-
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6355\OrderProductCount;
1817
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1918
use Symfony\Component\HttpFoundation\Request;
2019
use Symfony\Component\HttpKernel\Attribute\AsController;
2120

2221
#[AsController]
2322
class UpdateOrderProductCountController extends AbstractController
2423
{
25-
public function __invoke(OrderProductCount $data, Request $request): OrderDto
24+
public function __invoke(OrderDto $data, Request $request): OrderDto
2625
{
2726
$dto = new OrderDto();
2827
$dto->id = 1;

0 commit comments

Comments
 (0)