Skip to content

Commit

Permalink
Merge 4892de8 into 9f7f1e1
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Jul 28, 2021
2 parents 9f7f1e1 + 4892de8 commit ff3b073
Show file tree
Hide file tree
Showing 724 changed files with 13,755 additions and 2,309 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/ci.yml
Expand Up @@ -10,12 +10,13 @@ env:

jobs:
php-cs-fixer:
name: PHP-cs-fixer (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '7.4'
- '8'
fail-fast: false
env:
PHP_CS_FIXER_FUTURE_MODE: '1'
Expand All @@ -34,16 +35,17 @@ jobs:
run: php-cs-fixer fix --dry-run --diff --ansi

phpstan:
name: PHPStan
name: PHPStan (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '7.4'
- '8'
fail-fast: false
env:
APP_DEBUG: '1' # https://github.com/phpstan/phpstan-symfony/issues/37
SYMFONY_PHPUNIT_VERSION: '9.5'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -69,8 +71,6 @@ jobs:
- 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'
run: vendor/bin/simple-phpunit --version
- name: Cache PHPStan results
uses: actions/cache@v2
Expand Down Expand Up @@ -247,17 +247,27 @@ jobs:
if: (startsWith(matrix.php, '8.0'))
run: rm -Rf tests/Fixtures/app/var/cache/*
- name: Run Behat tests
if: (!startsWith(matrix.php, '8.0'))
run: |
mkdir -p build/logs/behat
if [ "$COVERAGE" = '1' ]; then
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default-coverage --no-interaction
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default-coverage --no-interaction --tags='~@php8'
else
if [ "${{ matrix.php }}" = '7.1' ]; then
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default --no-interaction --tags='~@symfony/uid'
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default --no-interaction --tags='~@symfony/uid&&~@php8'
else
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default --no-interaction
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default --no-interaction --tags='~@php8'
fi
fi
- name: Run Behat tests
if: (startsWith(matrix.php, '8.0'))
run: |
mkdir -p build/logs/behat
if [ "$COVERAGE" = '1' ]; then
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default-coverage --no-interaction
else
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=default --no-interaction
fi
- name: Merge code coverage reports
if: matrix.coverage
run: |
Expand Down Expand Up @@ -389,7 +399,7 @@ jobs:
run: tests/Fixtures/app/console cache:clear --ansi
- name: Run Behat tests
# @TODO remove the tag "@symfony/uid" in 3.0
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction --tags='~@symfony/uid'
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction --tags='~@symfony/uid&&~php8'

postgresql:
name: Behat (PHP ${{ matrix.php }}) (PostgreSQL)
Expand Down Expand Up @@ -440,7 +450,7 @@ jobs:
run: tests/Fixtures/app/console cache:clear --ansi
- name: Run Behat tests
run: |
vendor/bin/behat --out=std --format=progress --profile=postgres --no-interaction -vv
vendor/bin/behat --out=std --format=progress --profile=postgres --no-interaction -vv --tags='~php8'
mysql:
name: Behat (PHP ${{ matrix.php }}) (MySQL)
Expand Down Expand Up @@ -500,7 +510,7 @@ jobs:
strategy:
matrix:
php:
- '7.4'
- '8'
fail-fast: false
env:
APP_ENV: mongodb
Expand Down Expand Up @@ -647,12 +657,10 @@ jobs:
php:
- '8.0'
symfony:
- '5.4'
- '5.3'
fail-fast: false
env:
# See https://github.com/doctrine/DoctrineMongoDBBundle/pull/673
#SYMFONY_DEPRECATIONS_HELPER: max[direct]=0
SYMFONY_DEPRECATIONS_HELPER: max[self]=0
SYMFONY_DEPRECATIONS_HELPER: max[direct]=0
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -711,7 +719,7 @@ jobs:
php:
- '8.0'
symfony:
- '5.4'
- '5.3'
fail-fast: false
steps:
- name: Checkout
Expand Down Expand Up @@ -858,5 +866,10 @@ jobs:
- name: Clear test app cache
run: tests/Fixtures/app/console cache:clear --ansi
- name: Run Behat tests
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction
run: |
if ( "${{ matrix.php }}" -eq '7.4' ) {
vendor/bin/behat --out=std --format=progress --profile=default --no-interaction --tags='~@php8'
} else {
vendor/bin/behat --out=std --format=progress --profile=default --no-interaction
}
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Expand Up @@ -14,7 +14,7 @@
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude([
'src/Bridge/Symfony/Maker/Resources/skeleton',
'src/Core/Bridge/Symfony/Maker/Resources/skeleton',
'tests/Fixtures/app/var',
])
->notPath('src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php')
Expand Down
8 changes: 6 additions & 2 deletions composer.json
Expand Up @@ -80,6 +80,7 @@
"symfony/security-bundle": "^3.4 || ^4.4 || ^5.1",
"symfony/security-core": "^4.4 || ^5.1",
"symfony/twig-bundle": "^3.4 || ^4.4 || ^5.1",
"symfony/uid": "^5.1",
"symfony/validator": "^3.4 || ^4.4 || ^5.1",
"symfony/web-profiler-bundle": "^4.4 || ^5.1",
"symfony/yaml": "^3.4 || ^4.4 || ^5.1",
Expand Down Expand Up @@ -110,8 +111,11 @@
},
"autoload": {
"psr-4": {
"ApiPlatform\\Core\\": "src/"
}
"ApiPlatform\\": "src/"
},
"files": [
"src/deprecation.php"
]
},
"autoload-dev": {
"psr-4": {
Expand Down
11 changes: 6 additions & 5 deletions docs/adr/0002-resource-definition.md
Expand Up @@ -24,8 +24,7 @@ In API Platform, this resource identifier is also named [IRI (Internationalized
```php
<?php

#[Get]
#[Post]
#[Resource]
class Users
{
#[ApiProperty(iri="hydra:member")]
Expand All @@ -34,9 +33,11 @@ class Users
public float $averageRate;
}

#[Get]
#[Put]
#[Delete]
#[Resource("/companies/{companyId}/users/{id}", normalization_context=["groups"= [....]]), operations={}]
#[Resource(normalization_context=["groups"= [....]], operations=[
new Get(),
new Post(),
])]
class User
{
#[ApiProperty(identifier=true)]
Expand Down
23 changes: 23 additions & 0 deletions features/doctrine/search_filter.feature
Expand Up @@ -192,6 +192,7 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Search collection by name (partial)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?name=my"
Expand Down Expand Up @@ -232,6 +233,7 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Search collection by name (partial)
Given there are 30 embedded dummy objects
When I send a "GET" request to "/embedded_dummies?embeddedDummy.dummyName=my"
Expand Down Expand Up @@ -272,6 +274,7 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Search collection by name (partial multiple values)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?name[]=2&name[]=3"
Expand Down Expand Up @@ -312,7 +315,9 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Search collection by name (partial case insensitive)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?dummy=somedummytest1"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -340,7 +345,9 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Search collection by alias (start)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?alias=Ali"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -379,7 +386,9 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Search collection by alias (start multiple values)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?description[]=Sma&description[]=Not"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -419,7 +428,9 @@ Feature: Search filter on collections
"""

@sqlite
@createSchema
Scenario: Search collection by description (word_start)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?description=smart"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -458,8 +469,10 @@ Feature: Search filter on collections
}
"""

@createSchema
@sqlite
Scenario: Search collection by description (word_start multiple values)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?description[]=smart&description[]=so"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -500,7 +513,9 @@ Feature: Search filter on collections

# note on Postgres compared to sqlite the LIKE clause is case sensitive
@postgres
@createSchema
Scenario: Search collection by description (word_start)
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?description=smart"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -539,7 +554,9 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Search for entities within an impossible range
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?name=MuYm"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -568,7 +585,9 @@ Feature: Search filter on collections
"""

@sqlite
@createSchema
Scenario: Search for entities with an existing collection route name
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?relatedDummies=dummy_cars"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -659,7 +678,9 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Get collection by id 10
Given there are 30 dummy objects
When I send a "GET" request to "/dummies?id=10"
Then the response status code should be 200
And the response should be in JSON
Expand Down Expand Up @@ -696,8 +717,10 @@ Feature: Search filter on collections
}
"""

@createSchema
Scenario: Get collection ordered by a non valid properties
When I send a "GET" request to "/dummies?unknown=0"
Given there are 30 dummy objects
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/ld+json; charset=utf-8"
Expand Down
7 changes: 7 additions & 0 deletions features/graphql/query.feature
Expand Up @@ -19,7 +19,9 @@ Feature: GraphQL query support
And the JSON node "data.dummy.name" should be equal to "Dummy #1"
And the JSON node "data.dummy.name_converted" should be equal to "Converted 1"

@createSchema
Scenario: Retrieve a Relay Node
Given there are 2 dummy objects with relatedDummy
When I send the following GraphQL request:
"""
{
Expand All @@ -37,7 +39,9 @@ Feature: GraphQL query support
And the JSON node "data.node.id" should be equal to "/dummies/1"
And the JSON node "data.node.name" should be equal to "Dummy #1"

@createSchema
Scenario: Retrieve an item with an iterable field
Given there are 2 dummy objects with relatedDummy
Given there are 2 dummy objects with JSON and array data
When I send the following GraphQL request:
"""
Expand All @@ -59,6 +63,7 @@ Feature: GraphQL query support
And the JSON node "data.dummy.jsonData.bar" should be equal to 5
And the JSON node "data.dummy.arrayData[2]" should be equal to baz

@createSchema
Scenario: Retrieve an item with an iterable null field
Given there are 2 dummy with null JSON objects
When I send the following GraphQL request:
Expand All @@ -76,7 +81,9 @@ Feature: GraphQL query support
And the JSON node "data.withJsonDummy.id" should be equal to "/with_json_dummies/2"
And the JSON node "data.withJsonDummy.json" should be null

@createSchema
Scenario: Retrieve an item through a GraphQL query with variables
Given there are 2 dummy objects with relatedDummy
When I have the following GraphQL request:
"""
query DummyWithId($itemId: ID = "/dummies/1") {
Expand Down
2 changes: 2 additions & 0 deletions features/hal/input_output.feature
Expand Up @@ -2,6 +2,8 @@ Feature: HAL DTO input and output
In order to use a hypermedia API
As a client software developer
I need to be able to use DTOs on my resources as Input or Output objects.
TODO: in 3.0 we should change the generated IRIs, /dummy_dto_custom_output/1 should retrieve /dummy_dto_custom_output/1 not /dumy_dto_customs/1
for the collection we can search for an Operation with the same Output class as the given one for the collection

Background:
Given I add "Accept" header equal to "application/hal+json"
Expand Down

0 comments on commit ff3b073

Please sign in to comment.