Skip to content

Commit

Permalink
test: PATCH on controller w/ dto
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed May 13, 2024
1 parent 59dca65 commit cee303d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion features/main/patch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
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;

#[AsController]
class UpdateOrderProductCountController extends AbstractController
{
public function __invoke(OrderProductCount $data, Request $request): OrderDto
public function __invoke(): OrderDto
{
$dto = new OrderDto();
$dto->id = 1;
Expand Down

0 comments on commit cee303d

Please sign in to comment.