Skip to content

Commit 3fb7231

Browse files
authored
test: PATCH on controller w/ dto (#6368)
* test: PATCH on controller w/ dto * ci: allow uppercase commit message start
1 parent 77a917f commit 3fb7231

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

.commitlintrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@
5555
[
5656
"sentence-case",
5757
"start-case",
58-
"pascal-case",
59-
"upper-case"
58+
"pascal-case"
6059
]
6160
],
6261
"subject-empty": [

behat.yml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ legacy:
203203
- 'Behat\MinkExtension\Context\MinkContext'
204204
- 'behatch:context:rest'
205205
filters:
206-
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@link_security'
206+
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@link_security&&~@use_listener'
207207
extensions:
208208
'FriendsOfBehat\SymfonyExtension':
209209
bootstrap: 'tests/Fixtures/app/bootstrap.php'

features/main/patch.feature

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

84+
@use_listener
85+
@controller
86+
# Previously to 3.3 it was not possible to disable a read, this test is ignored on the
87+
# legacy test suite (EVENT_LISTENERS_BACKWARD_COMPATIBILITY_LAYER=1)
8488
Scenario: Patch a non-readable resource
8589
When I add "Content-Type" header equal to "application/merge-patch+json"
8690
And I send a "PATCH" request to "/order_products/1/count" with body:
@@ -89,5 +93,7 @@ Feature: Sending PATCH requets
8993
"id": 1,
9094
"count": 10
9195
}
96+
9297
"""
93-
Then print last JSON response
98+
Then the response status code should be 200
99+
And the JSON node "id" should contain "1"

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@
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;
19-
use Symfony\Component\HttpFoundation\Request;
2018
use Symfony\Component\HttpKernel\Attribute\AsController;
2119

2220
#[AsController]
2321
class UpdateOrderProductCountController extends AbstractController
2422
{
25-
public function __invoke(OrderProductCount $data, Request $request): OrderDto
23+
public function __invoke(): OrderDto
2624
{
2725
$dto = new OrderDto();
2826
$dto->id = 1;

0 commit comments

Comments
 (0)