Skip to content

Commit da9cf7e

Browse files
committed
fix mongodb tests
1 parent f10e69e commit da9cf7e

File tree

4 files changed

+6
-37
lines changed

4 files changed

+6
-37
lines changed

features/mongodb/filters.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Feature: Filters on collections
1010
When I send a "GET" request to "/dummies?relatedDummy.thirdLevel.badFourthLevel.level=4"
1111
Then the response status code should be 500
1212
And the response should be in JSON
13-
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
13+
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
1414
And the JSON node "@context" should be equal to "/contexts/Error"
1515
And the JSON node "@type" should be equal to "hydra:Error"
1616
And the JSON node "hydra:title" should be equal to "An error occurred"
@@ -21,7 +21,7 @@ Feature: Filters on collections
2121
When I send a "GET" request to "/dummies?relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level=3"
2222
Then the response status code should be 500
2323
And the response should be in JSON
24-
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
24+
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
2525
And the JSON node "@context" should be equal to "/contexts/Error"
2626
And the JSON node "@type" should be equal to "hydra:Error"
2727
And the JSON node "hydra:title" should be equal to "An error occurred"

tests/Fixtures/TestBundle/Controller/MongoDbOdm/DummyValidationController.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

tests/Fixtures/TestBundle/Document/DummyValidation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#[ApiResource(operations: [
2323
new GetCollection(),
2424
new Post(uriTemplate: 'dummy_validation{._format}'),
25-
new Post(routeName: 'post_validation_groups', validationContext: ['groups' => ['a']], extraProperties: ['rfc_7807_compliant_errors' => false]),
26-
new Post(routeName: 'post_validation_sequence', validationContext: ['groups' => 'app.dummy_validation.group_generator'], extraProperties: ['rfc_7807_compliant_errors' => false]),
25+
new Post(uriTemplate: '/dummy_validation/validation_groups', validationContext: ['groups' => ['a']], extraProperties: ['rfc_7807_compliant_errors' => false]),
26+
new Post(uriTemplate: '/dummy_validation/validation_sequence', validationContext: ['groups' => 'app.dummy_validation.group_generator'], extraProperties: ['rfc_7807_compliant_errors' => false]),
2727
]
2828
)]
2929
#[ODM\Document]

tests/Fixtures/TestBundle/State/DummyDtoInputOutputProcessor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ApiPlatform\Metadata\Operation;
1717
use ApiPlatform\State\ProcessorInterface;
1818
use ApiPlatform\Tests\Fixtures\TestBundle\Document\DummyDtoInputOutput as DummyDtoInputOutputDocument;
19+
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\Document\InputDto as InputDtoDocument;
1920
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\Document\OutputDto as OutputDtoDocument;
2021
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\InputDto;
2122
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\OutputDto;
@@ -36,7 +37,7 @@ public function __construct(private readonly ManagerRegistry $registry)
3637
*/
3738
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = [])
3839
{
39-
if (!$data instanceof InputDto) {
40+
if (!$data instanceof InputDto && !$data instanceof InputDtoDocument) {
4041
throw new \RuntimeException('Data is not an InputDto');
4142
}
4243

0 commit comments

Comments
 (0)