Skip to content

Commit

Permalink
Merge d0931ba into 287b79c
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Jun 8, 2021
2 parents 287b79c + d0931ba commit 28135e0
Show file tree
Hide file tree
Showing 39 changed files with 672 additions and 130 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/ci.yml
Expand Up @@ -66,8 +66,8 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
env:
SYMFONY_PHPUNIT_VERSION: '9.5'
Expand All @@ -87,7 +87,7 @@ jobs:
- name: Run PHPStan analysis
env:
SYMFONY_PHPUNIT_VERSION: '9.5'
run: ./vendor/bin/phpstan analyse --no-interaction --no-progress --no-interaction --ansi
run: ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi

phpunit:
name: PHPUnit (PHP ${{ matrix.php }})
Expand Down Expand Up @@ -140,9 +140,9 @@ jobs:
composer config platform.php 7.4.99
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
- name: Require Symfony components
if: (!startsWith(matrix.php, '7.1'))
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -235,9 +235,9 @@ jobs:
doctrine/mongodb-odm-bundle \
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
- name: Require Symfony components
if: (!startsWith(matrix.php, '7.1'))
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -341,8 +341,8 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi --prefer-lowest
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Clear test app cache
run: tests/Fixtures/app/console cache:clear --ansi
- name: Install PHPUnit
Expand Down Expand Up @@ -381,8 +381,8 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi --prefer-lowest
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -432,8 +432,8 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -484,8 +484,8 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -531,8 +531,8 @@ jobs:
- name: Update project dependencies
run: |
composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -585,8 +585,8 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install Elasticsearch-php # there is a version matrix for this package: https://packagist.org/packages/elasticsearch/elasticsearch
run: composer require "elasticsearch/elasticsearch:v6.7.2" --no-interaction --no-progress --ansi
- name: Install PHPUnit
Expand Down Expand Up @@ -629,8 +629,8 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install PHPUnit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -677,8 +677,8 @@ jobs:
run: rm -Rf tests/Fixtures/app/var/cache/*
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid symfony/intl --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Flag held back Symfony packages
env:
symfony_version: ${{ matrix.symfony }}
Expand Down Expand Up @@ -739,8 +739,8 @@ jobs:
run: rm -Rf tests/Fixtures/app/var/cache/*
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Flag held back Symfony packages
env:
symfony_version: ${{ matrix.symfony }}
Expand Down Expand Up @@ -801,8 +801,8 @@ jobs:
composer config platform.php 7.4.99
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install phpunit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down Expand Up @@ -849,8 +849,8 @@ jobs:
composer config platform.php 7.4.99
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Require Symfony Uid
run: composer require symfony/uid --dev --no-interaction --no-progress --ansi
- name: Require Symfony components
run: composer require symfony/intl symfony/uid --dev --no-interaction --no-progress --ansi
- name: Install phpunit
run: vendor/bin/simple-phpunit --version
- name: Clear test app cache
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -42,6 +42,7 @@
* Symfony: Add tests with Symfony Uuid (#4230)
* OpenAPI: Allow to set extensionProperties with YAML schema definition (#4228)
* GraphQL: Fix `FieldsBuilder` not fully unwrapping nested types before deciding if a resolver is needed (#4251)
* GraphQL: Do not use a resolver for the nested payload of a mutation or subscription (#4289)

## 2.6.4

Expand Down
32 changes: 31 additions & 1 deletion features/graphql/filters.feature
Expand Up @@ -84,6 +84,36 @@ Feature: Collections filtering
Then the JSON node "data.dummies.edges" should have 1 element
And the JSON node "data.dummies.edges[0].node.id" should be equal to "/dummies/2"

@createSchema
Scenario: Retrieve a collection filtered using the search filter with an int
Given there are 4 dummy objects having each 3 relatedDummies
When I send the following GraphQL request:
"""
{
dummies(name: "Dummy #1") {
totalCount
edges {
node {
name
relatedDummies(age: 31) {
totalCount
edges {
node {
id
name
age
}
}
}
}
}
}
}
"""
Then the JSON node "data.dummies.totalCount" should be equal to 1
And the JSON node "data.dummies.edges[0].node.relatedDummies.totalCount" should be equal to 1
And the JSON node "data.dummies.edges[0].node.relatedDummies.edges[0].node.age" should be equal to "31"

@createSchema
Scenario: Retrieve a collection filtered using the search filter and a name converter
Given there are 10 dummy objects
Expand Down Expand Up @@ -130,7 +160,7 @@ Feature: Collections filtering
And the JSON node "data.convertedOwners.edges[1].node.name_converted.name_converted" should be equal to "Converted 20"

@createSchema
Scenario: Retrieve a collection filtered using the search filter
Scenario: Retrieve a nested collection filtered using the search filter
Given there are 3 dummy objects having each 3 relatedDummies
When I send the following GraphQL request:
"""
Expand Down
38 changes: 38 additions & 0 deletions features/graphql/mutation.feature
Expand Up @@ -662,6 +662,44 @@ Feature: GraphQL mutation support
And the JSON node "data.createDummyGroup.dummyGroup.__typename" should be equal to "createDummyGroupPayloadData"
And the JSON node "data.createDummyGroup.clientMutationId" should be equal to "myId"

@createSchema
Scenario: Use serialization groups with relations
Given there is 1 dummy object with relatedDummy and its thirdLevel
And there is a RelatedDummy with 2 friends
When I send the following GraphQL request:
"""
mutation {
updateRelatedDummy(input: {id: "/related_dummies/2", symfony: "laravel", embeddedDummy: "{}", thirdLevel: "/third_levels/1"}) {
relatedDummy {
id
symfony
thirdLevel {
id
__typename
}
relatedToDummyFriend {
edges {
node {
name
}
}
__typename
}
}
}
}
"""
Then the response status code should be 200
And the response should be in JSON
And the header "Content-Type" should be equal to "application/json"
And the JSON node "data.updateRelatedDummy.relatedDummy.id" should be equal to "/related_dummies/2"
And the JSON node "data.updateRelatedDummy.relatedDummy.symfony" should be equal to "laravel"
And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.id" should be equal to "/third_levels/1"
And the JSON node "data.updateRelatedDummy.relatedDummy.thirdLevel.__typename" should be equal to "updateThirdLevelNestedPayload"
And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.__typename" should be equal to "updateRelatedToDummyFriendNestedPayloadConnection"
And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.edges[0].node.name" should be equal to "Relation-1"
And the JSON node "data.updateRelatedDummy.relatedDummy.relatedToDummyFriend.edges[1].node.name" should be equal to "Relation-2"

Scenario: Trigger a validation error
When I send the following GraphQL request:
"""
Expand Down
28 changes: 26 additions & 2 deletions features/main/subresource.feature
Expand Up @@ -104,7 +104,7 @@ Feature: Subresource support
"hydra:totalItems": 2,
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/dummies/1/related_dummies{?relatedToDummyFriend.dummyFriend,relatedToDummyFriend.dummyFriend[],name}",
"hydra:template": "/dummies/1/related_dummies{?relatedToDummyFriend.dummyFriend,relatedToDummyFriend.dummyFriend[],name,age,age[]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
Expand All @@ -124,6 +124,18 @@ Feature: Subresource support
"variable": "name",
"property": "name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "age",
"property": "age",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "age[]",
"property": "age",
"required": false
}
]
}
Expand Down Expand Up @@ -167,7 +179,7 @@ Feature: Subresource support
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/dummies/1/related_dummies{?relatedToDummyFriend.dummyFriend,relatedToDummyFriend.dummyFriend[],name}",
"hydra:template": "/dummies/1/related_dummies{?relatedToDummyFriend.dummyFriend,relatedToDummyFriend.dummyFriend[],name,age,age[]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
Expand All @@ -187,6 +199,18 @@ Feature: Subresource support
"variable": "name",
"property": "name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "age",
"property": "age",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "age[]",
"property": "age",
"required": false
}
]
}
Expand Down
8 changes: 0 additions & 8 deletions phpstan.neon.dist
Expand Up @@ -84,14 +84,6 @@ parameters:
-
message: '#Service "test" is not registered in the container\.#'
path: tests/GraphQl/Type/TypesContainerTest.php
-
message: '#Property Doctrine\\ORM\\Mapping\\ClassMetadataInfo::\$fieldMappings \(array.*\)>\) does not accept array\(.*\)\.#'
path: tests/Bridge/Doctrine/Orm/Metadata/Property/DoctrineOrmPropertyMetadataFactoryTest.php

# Expected, Symfony 5.3
- '#getCollectionValueT|getCollectionKeyTyp#'
- '#isPasswordValid#'
- '#UserPasswordHasherInterface#'

# Expected, due to PHP 8 attributes
- '#ReflectionProperty::getAttributes\(\)#'
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Common/Filter/SearchFilterTrait.php
Expand Up @@ -136,7 +136,7 @@ protected function getIdFromValue(string $value)
protected function normalizeValues(array $values, string $property): ?array
{
foreach ($values as $key => $value) {
if (!\is_int($key) || !\is_string($value)) {
if (!\is_int($key) || !(\is_string($value) || \is_int($value))) {
unset($values[$key]);
}
}
Expand Down

0 comments on commit 28135e0

Please sign in to comment.