Skip to content

Commit 9eb6f71

Browse files
committed
tests(mongodb): various fixes due to rector changes
1 parent 6f01eae commit 9eb6f71

31 files changed

+178
-149
lines changed

features/hydra/docs.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Feature: Documentation support
6363
And "plainPassword" property is writable for Hydra class "User"
6464
And "plainPassword" property is not required for Hydra class "User"
6565
And the value of the node "@type" of the property "name" of the Hydra class "Dummy" is "hydra:SupportedProperty"
66-
And the value of the node "hydra:property.@id" of the property "name" of the Hydra class "Dummy" is "http://schema.org/name"
66+
And the value of the node "hydra:property.@id" of the property "name" of the Hydra class "Dummy" is "https://schema.org/name"
6767
And the value of the node "hydra:property.@type" of the property "name" of the Hydra class "Dummy" is "rdf:Property"
6868
And the value of the node "hydra:property.rdfs:label" of the property "name" of the Hydra class "Dummy" is "name"
6969
And the value of the node "hydra:property.domain" of the property "name" of the Hydra class "Dummy" is "#Dummy"

features/jsonld/context.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Feature: JSON-LD contexts generation
2727
"description": "https://schema.org/description",
2828
"dummy": "Dummy/dummy",
2929
"dummyBoolean": "Dummy/dummyBoolean",
30-
"dummyDate": "http://schema.org/DateTime",
30+
"dummyDate": "https://schema.org/DateTime",
3131
"dummyFloat": "Dummy/dummyFloat",
3232
"dummyPrice": "Dummy/dummyPrice",
3333
"relatedDummy": {
@@ -41,7 +41,7 @@ Feature: JSON-LD contexts generation
4141
"jsonData": "Dummy/jsonData",
4242
"arrayData": "Dummy/arrayData",
4343
"nameConverted": "Dummy/nameConverted",
44-
"name": "http://schema.org/name",
44+
"name": "https://schema.org/name",
4545
"alias": "https://schema.org/alternateName",
4646
"foo": "Dummy/foo"
4747
}

features/openapi/docs.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ Feature: Documentation support
239239
Then the response status code should be 200
240240
And I should see text matching "openapi"
241241

242+
@!mongodb
242243
Scenario: Retrieve the OpenAPI documentation with API Gateway compatibility
243244
Given I send a "GET" request to "/docs.json?api_gateway=true"
244245
Then the response status code should be 200

src/Doctrine/Odm/Filter/ExistsFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(ManagerRegistry $managerRegistry, LoggerInterface $l
5353
*/
5454
public function apply(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void
5555
{
56-
foreach ($context['filters'][$this->existsParameterName] as $property => $value) {
56+
foreach ($context['filters'][$this->existsParameterName] ?? [] as $property => $value) {
5757
$this->filterProperty($this->denormalizePropertyName($property), $value, $aggregationBuilder, $resourceClass, $operation, $context);
5858
}
5959
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class DummyValidationController
2121
/**
2222
* @param mixed $data
2323
*/
24-
#[Route(methods: ['POST'], name: 'post_validation_groups', path: '/dummy_validation/validation_groups', defaults: ['_api_resource_class' => DummyValidation::class, '_api_collection_operation_name' => 'post_validation_groups'])]
24+
#[Route(methods: ['POST'], name: 'post_validation_groups', path: '/dummy_validation/validation_groups', defaults: ['_api_resource_class' => DummyValidation::class, '_api_operation_name' => 'post_validation_groups'])]
2525
public function postValidationGroups($data)
2626
{
2727
return $data;
@@ -30,7 +30,7 @@ public function postValidationGroups($data)
3030
/**
3131
* @param mixed $data
3232
*/
33-
#[Route(methods: ['POST'], name: 'post_validation_sequence', path: '/dummy_validation/validation_sequence', defaults: ['_api_resource_class' => DummyValidation::class, '_api_collection_operation_name' => 'post_validation_sequence'])]
33+
#[Route(methods: ['POST'], name: 'post_validation_sequence', path: '/dummy_validation/validation_sequence', defaults: ['_api_resource_class' => DummyValidation::class, '_api_operation_name' => 'post_validation_sequence'])]
3434
public function postValidationSequence($data)
3535
{
3636
return $data;

tests/Fixtures/TestBundle/Document/Content.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ class Content implements \JsonSerializable
2727
#[ODM\Id(strategy: 'INCREMENT', type: 'int')]
2828
private ?int $id = null;
2929
#[ODM\Field(type: 'string')]
30-
private ?string $contentType = null;
30+
private string $contentType;
3131
/**
3232
* @var Collection<Field>
3333
*/
3434
#[ODM\ReferenceMany(targetDocument: Field::class, mappedBy: 'content', strategy: 'set', cascade: ['persist'])]
3535
private \Doctrine\Common\Collections\Collection $fields;
3636
#[ODM\Field(type: 'string')]
37-
private readonly string $status;
37+
private string $status;
3838

3939
public function __construct()
4040
{

tests/Fixtures/TestBundle/Document/CustomGeneratedIdentifier.php

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

1616
use ApiPlatform\Metadata\ApiResource;
17-
use ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Generator\Uuid;
1817
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
1918

2019
/**
@@ -25,7 +24,7 @@
2524
class CustomGeneratedIdentifier
2625
{
2726
#[ODM\Id(strategy: 'CUSTOM', type: 'string', options: ['class' => \ApiPlatform\Tests\Fixtures\TestBundle\Doctrine\Generator\DocumentUuidGenerator::class])]
28-
private ?Uuid $id = null;
27+
private ?string $id = null;
2928

3029
public function getId()
3130
{

tests/Fixtures/TestBundle/Document/Dummy.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ class Dummy
4242
/**
4343
* @var string|null The dummy name
4444
*/
45-
#[ApiProperty(types: ['http://schema.org/name'])]
45+
#[ApiProperty(iris: ['https://schema.org/name'])]
4646
#[Assert\NotBlank]
4747
#[ODM\Field(type: 'string')]
4848
private $name;
4949
/**
5050
* @var string|null The dummy name alias
5151
*/
52-
#[ApiProperty(types: ['http://schema.org/alternateName'])]
52+
#[ApiProperty(iris: ['https://schema.org/alternateName'])]
5353
#[ODM\Field(nullable: true)]
5454
private $alias;
5555
/**
@@ -59,7 +59,7 @@ class Dummy
5959
/**
6060
* @var string|null A short description of the item
6161
*/
62-
#[ApiProperty(types: ['http://schema.org/description'])]
62+
#[ApiProperty(iris: ['https://schema.org/description'])]
6363
#[ODM\Field(type: 'string', nullable: true)]
6464
public $description;
6565
/**
@@ -75,7 +75,7 @@ class Dummy
7575
/**
7676
* @var \DateTime|null A dummy date
7777
*/
78-
#[ApiProperty(types: ['http://schema.org/DateTime'])]
78+
#[ApiProperty(iris: ['https://schema.org/DateTime'])]
7979
#[ODM\Field(type: 'date', nullable: true)]
8080
public $dummyDate;
8181
/**

tests/Fixtures/TestBundle/Document/DummyCustomQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
], name: 'testItemCustomArguments'),
4343
new QueryCollection(resolver: 'app.graphql.query_resolver.dummy_custom_collection', name: 'testCollection'),
4444
new QueryCollection(resolver: 'app.graphql.query_resolver.dummy_custom_collection_no_read_and_serialize', read: false, serialize: false, name: 'testCollectionNoReadAndSerialize'),
45-
new Query(
45+
new QueryCollection(
4646
name: 'testCollectionCustomArguments',
4747
resolver: 'app.graphql.query_resolver.dummy_custom_collection',
4848
args: ['customArgumentString' => ['type' => 'String!']]),

tests/Fixtures/TestBundle/Document/DummyDtoCustom.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,25 @@
2121
use ApiPlatform\Metadata\Put;
2222
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\CustomInputDto;
2323
use ApiPlatform\Tests\Fixtures\TestBundle\Dto\CustomOutputDto;
24+
use ApiPlatform\Tests\Fixtures\TestBundle\State\CustomInputDtoProcessor;
25+
use ApiPlatform\Tests\Fixtures\TestBundle\State\CustomOutputDtoProvider;
2426
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
2527

2628
/**
2729
* DummyDtoCustom.
2830
*/
29-
#[ApiResource(operations: [new Get(), new Get(output: CustomOutputDto::class, uriTemplate: 'dummy_dto_custom_output/{id}'), new Put(), new Delete(), new Post(input: CustomInputDto::class), new GetCollection(), new GetCollection(output: CustomOutputDto::class, uriTemplate: 'dummy_dto_custom_output'), new Post(output: false, uriTemplate: 'dummy_dto_custom_post_without_output')])]
31+
#[ApiResource(
32+
operations: [
33+
new Get(),
34+
new Put(),
35+
new Delete(),
36+
new Post(input: CustomInputDto::class, processor: CustomInputDtoProcessor::class),
37+
new GetCollection(),
38+
new GetCollection(output: CustomOutputDto::class, uriTemplate: 'dummy_dto_custom_output', provider: CustomOutputDtoProvider::class),
39+
new Get(output: CustomOutputDto::class, uriTemplate: 'dummy_dto_custom_output/{id}', provider: CustomOutputDtoProvider::class),
40+
new Post(output: false, uriTemplate: 'dummy_dto_custom_post_without_output'),
41+
]
42+
)]
3043
#[ODM\Document]
3144
class DummyDtoCustom
3245
{

0 commit comments

Comments
 (0)