Skip to content

[Do not merge] Revert merge master into 2.2 #1923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
259775a
Fix the Behat test suite with low dependencies
meyerbaptiste Apr 12, 2018
d6e7d66
Merge pull request #1853 from meyerbaptiste/fix_behatch_low_dependencies
meyerbaptiste Apr 12, 2018
d120915
add page number type validation
IonBazan Apr 15, 2018
d99dc23
Merge pull request #1871 from IonBazan/page-number-int
soyuka Apr 18, 2018
faeef0f
add missing doctrine alias removed in [email protected]
Apr 19, 2018
8b395db
Merge pull request #1876 from soyuka/fix-tests
soyuka Apr 19, 2018
27ca121
fix exists filter
IonBazan Apr 13, 2018
a4bfa4e
Merge pull request #1861 from IonBazan/exists-fix
soyuka Apr 19, 2018
a675a8e
Enable item route on collection subresources
Apr 18, 2018
af6a018
Merge pull request #1875 from soyuka/subresource-item
dunglas Apr 20, 2018
81fcdd8
Revert 3465b41bd55f46faeab1aae9c80cd16a08d5e27e
Apr 23, 2018
d917eaa
The OrderFilter is still triggering bad deprecation/function calls
antograssiot Apr 14, 2018
4bd2b82
Merge pull request #1866 from antograssiot/order-filter
dunglas Apr 20, 2018
f92ea0d
Allow GraphQL to filter on nested property (#1868)
antograssiot Apr 20, 2018
753a36e
Remove useless double check of access_control in resolvers
alanpoulain Apr 23, 2018
f522a6f
Move coverage jobs to CircleCI
teohhanhui Apr 23, 2018
40dffef
add some local caches where they are missing
bendavies Apr 25, 2018
7e572bd
fix normalizer cache key generation
bendavies Apr 26, 2018
60fe687
respect forceEager=false on an association
bendavies Apr 26, 2018
9630a84
simplify boolean filter
bendavies Apr 30, 2018
0cd2625
Revert "Simplify boolean filter"
teohhanhui Apr 30, 2018
fe04848
introduce cache trait to reuse common pattern
bendavies Apr 30, 2018
1fd33ce
Update graphql-php to 0.11.5
alanpoulain Apr 15, 2018
5b82c70
Add a better test for introspection
alanpoulain Apr 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
version: 2

reusable-steps:
- &clear-test-app-cache
run:
name: Clear test app cache
command: tests/Fixtures/app/console cache:clear
- &disable-php-memory-limit
run:
name: Disable PHP memory limit
command: echo 'memory_limit=-1' | sudo tee -a /usr/local/etc/php/php.ini
- &disable-xdebug-php-extension
run:
name: Disable Xdebug PHP extension
command: sudo rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- &restore-composer-cache
restore_cache:
keys:
- composer-cache-{{ .Revision }}
- composer-cache-{{ .Branch }}
- composer-cache
- &restore-npm-cache
restore_cache:
keys:
- npm-cache-{{ .Revision }}
- npm-cache-{{ .Branch }}
- npm-cache
- &save-composer-cache-by-branch
save_cache:
paths:
- ~/.composer/cache
key: composer-cache-{{ .Branch }}-{{ .BuildNum }}
- &save-composer-cache-by-revision
save_cache:
paths:
- ~/.composer/cache
key: composer-cache-{{ .Revision }}-{{ .BuildNum }}
- &save-npm-cache-by-branch
save_cache:
paths:
- ~/.npm
key: npm-cache-{{ .Branch }}-{{ .BuildNum }}
- &save-npm-cache-by-revision
save_cache:
paths:
- ~/.npm
key: npm-cache-{{ .Revision }}-{{ .BuildNum }}
- &update-composer
run:
name: Update Composer
command: composer self-update
- &update-project-dependencies
run:
name: Update project dependencies
command: composer update --prefer-dist --no-progress --no-suggest --ansi

jobs:
phpunit-php-7.2-coverage:
docker:
- image: circleci/php:7.2-node-browsers
environment:
SYMFONY_DEPRECATIONS_HELPER: weak_vendors
APP_ENV: test
parallelism: 2
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-composer-cache
- *restore-npm-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *update-composer
- *update-project-dependencies
- *save-composer-cache-by-revision
- *save-composer-cache-by-branch
- *clear-test-app-cache
- run:
name: Run PHPUnit tests
command: |-
mkdir -p build/logs/tmp build/cov
find tests -name '*Test.php' | circleci tests split --split-by=timings | parallel -j10% --rpl '{_} s/\//_/g;' \
phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-{_}.cov --log-junit build/logs/tmp/{_}.xml --colors=always {}
- run:
name: Merge PHPUnit test reports
command: |-
mkdir -p build/logs/phpunit
npx junit-merge --out build/logs/phpunit/junit.xml --dir build/logs/tmp
rm -r build/logs/tmp
- store_test_results:
path: build/logs
- store_artifacts:
path: build/logs/phpunit/junit.xml
destination: build/logs/phpunit/junit.xml
- persist_to_workspace:
root: build
paths:
- cov
- *save-npm-cache-by-revision
- *save-npm-cache-by-branch

behat-php-7.2-coverage:
docker:
- image: circleci/php:7.2-node-browsers
environment:
SYMFONY_DEPRECATIONS_HELPER: weak_vendors
APP_ENV: test
parallelism: 2
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-composer-cache
- *restore-npm-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *update-composer
- *update-project-dependencies
- *save-composer-cache-by-revision
- *save-composer-cache-by-branch
- *clear-test-app-cache
- run:
name: Run Behat tests
command: |-
mkdir -p build/logs/tmp build/cov
for f in $(find features -name '*.feature' -not -path 'features/main/exposed_state.feature' | circleci tests split --split-by=timings); do
_f=${f//\//_}
FEATURE="${_f}" phpdbg -qrr vendor/bin/behat --profile=coverage --suite=default --tags=~@postgres --format=progress --out=std --format=junit --out=build/logs/tmp/"${_f}" "$f"
done
- run:
name: Merge Behat test reports
command: |-
mkdir -p build/logs/behat
npx junit-merge --out build/logs/behat/junit.xml --dir build/logs/tmp --recursive
rm -r build/logs/tmp
- store_test_results:
path: build/logs
- store_artifacts:
path: build/logs/behat/junit.xml
destination: build/logs/behat/junit.xml
- persist_to_workspace:
root: build
paths:
- cov
- *save-npm-cache-by-revision
- *save-npm-cache-by-branch

merge-and-upload-coverage:
docker:
- image: circleci/php:7.2-node-browsers
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-npm-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- run:
name: Download phpcov
command: wget https://phar.phpunit.de/phpcov.phar
- attach_workspace:
at: build
- run:
name: Merge code coverage reports
command: |-
mkdir -p build/logs
phpdbg -qrr phpcov.phar merge --clover build/logs/clover.xml build/cov
- store_artifacts:
path: build/logs/clover.xml
destination: build/logs/clover.xml
- run:
name: Upload code coverage report to Coveralls
command: |-
if [ ! -z "$COVERALLS_REPO_TOKEN" ]; then
npx @cedx/coveralls build/logs/clover.xml
else
echo 'Skipped'
fi
- run:
name: Upload code coverage report to Codecov
command: npx codecov --file=build/logs/clover.xml --disable=gcov
- *save-npm-cache-by-revision
- *save-npm-cache-by-branch

workflows:
version: 2
test-with-coverage:
jobs:
- phpunit-php-7.2-coverage
- behat-php-7.2-coverage
- merge-and-upload-coverage:
requires:
- phpunit-php-7.2-coverage
- behat-php-7.2-coverage
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[.circleci/config.yml]
indent_style = space
indent_size = 2

[.gitmodules]
indent_style = tab

Expand Down
48 changes: 11 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: php

sudo: false

cache:
Expand All @@ -17,8 +16,6 @@ matrix:
- php: '7.0'
- php: '7.1'
- php: '7.2'
- php: '7.2'
env: coverage=1
- php: '7.2'
env: lint=1
- php: '7.2'
Expand All @@ -43,18 +40,6 @@ matrix:
before_install:
- phpenv config-rm xdebug.ini || echo "xdebug not available"
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- if [[ $coverage != 1 && $lint != 1 ]]; then
npm install -g swagger-cli;
fi
- if [[ $coverage = 1 ]]; then
mkdir -p build/logs build/cov;
fi
- if [[ $coverage = 1 ]]; then
wget https://phar.phpunit.de/phpcov.phar;
fi
- if [[ $coverage = 1 ]]; then
wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar;
fi
- if [[ $lint = 1 ]]; then
wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.8.4/php-cs-fixer.phar;
fi
Expand All @@ -64,44 +49,33 @@ before_install:
- export PATH="$PATH:$HOME/.composer/vendor/bin"

install:
- if [[ $coverage = 1 ]]; then
composer require --dev --no-update 'phpunit/php-code-coverage:^5.2.2';
fi
- if [[ $deps = 'low' ]]; then
composer update --prefer-dist --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi;
else
composer update --prefer-dist --no-progress --no-suggest --ansi;
fi

script:
- if [[ $coverage = 1 ]]; then
APP_ENV=test_phpunit phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-phpunit.cov;
elif [[ $lint != 1 ]]; then
APP_ENV=test_phpunit vendor/bin/phpunit;
- if [[ $lint != 1 ]]; then
tests/Fixtures/app/console cache:clear;
fi
- if [[ $lint != 1 ]]; then
vendor/bin/phpunit;
fi
- if [[ $lint != 1 ]]; then
tests/Fixtures/app/console cache:clear;
fi
- if [[ $coverage = 1 ]]; then
for f in $(find features -name '*.feature' -not -path 'features/main/exposed_state.feature'); do
FEATURE=${f//\//_} phpdbg -qrr vendor/bin/behat --profile=coverage --suite=default --tags=~@postgress --format=progress $f || exit $?;
done;
elif [[ $APP_ENV = 'postgres' ]]; then
- if [[ $APP_ENV = 'postgres' ]]; then
vendor/bin/behat --suite=postgres --format=progress;
elif [[ $lint != 1 ]]; then
vendor/bin/behat --suite=default --format=progress;
fi
- if [[ $coverage = 1 ]]; then
phpdbg -qrr phpcov.phar merge --clover build/logs/clover.xml build/cov;
fi
- if [[ $coverage != 1 && $lint != 1 ]]; then
tests/Fixtures/app/console api:swagger:export > swagger.json && swagger-cli validate swagger.json && rm swagger.json;
- if [[ $lint != 1 ]]; then
tests/Fixtures/app/console api:swagger:export > swagger.json && npx swagger-cli validate swagger.json && rm swagger.json;
fi
- if [[ $lint = 1 ]]; then
php php-cs-fixer.phar fix --dry-run --diff --no-ansi;
fi
- if [[ $lint = 1 ]]; then
phpstan analyse -c phpstan.neon -l5 --ansi src tests;
fi

after_success:
- if [[ $coverage = 1 ]]; then
travis_retry php coveralls.phar;
fi
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"behat/mink-browserkit-driver": "^1.3.1",
"behat/mink-extension": "^2.2",
"behat/symfony2-extension": "^2.1.1",
"behatch/contexts": "^3.0@dev",
"behatch/contexts": "^3.1",
"doctrine/annotations": "^1.2",
"doctrine/doctrine-bundle": "^1.6.3",
"doctrine/orm": "^2.5.2",
Expand Down Expand Up @@ -64,7 +64,7 @@
"symfony/twig-bundle": "^3.1 || ^4.0",
"symfony/validator": "^3.3 || ^4.0",
"symfony/yaml": "^3.3 || ^4.0",
"webonyx/graphql-php": "^0.10.2"
"webonyx/graphql-php": "^0.11.5"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
Expand Down
10 changes: 10 additions & 0 deletions features/bootstrap/GraphqlContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Behat\Gherkin\Node\PyStringNode;
use Behatch\Context\RestContext;
use Behatch\HttpCall\Request;
use GraphQL\Type\Introspection;

/**
* Context for GraphQL.
Expand Down Expand Up @@ -95,6 +96,15 @@ public function ISendTheGraphqlRequestWithOperation(string $operation)
$this->sendGraphqlRequest();
}

/**
* @When I send the query to introspect the schema
*/
public function ISendTheQueryToIntrospectTheSchema()
{
$this->graphqlRequest = ['query' => Introspection::getIntrospectionQuery()];
$this->sendGraphqlRequest();
}

private function sendGraphqlRequest()
{
$this->request->setHttpHeader('Accept', null);
Expand Down
16 changes: 14 additions & 2 deletions features/doctrine/date_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ Feature: Date filter on collections
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/dummies{?dummyBoolean,relatedDummy.embeddedDummy.dummyBoolean,dummyDate[before],dummyDate[strictly_before],dummyDate[after],dummyDate[strictly_after],relatedDummy.dummyDate[before],relatedDummy.dummyDate[strictly_before],relatedDummy.dummyDate[after],relatedDummy.dummyDate[strictly_after],description[exists],relatedDummy.name[exists],dummyBoolean[exists],dummyFloat,dummyPrice,order[id],order[name],order[description],order[relatedDummy.name],order[relatedDummy.symfony],order[dummyDate],dummyFloat[between],dummyFloat[gt],dummyFloat[gte],dummyFloat[lt],dummyFloat[lte],dummyPrice[between],dummyPrice[gt],dummyPrice[gte],dummyPrice[lt],dummyPrice[lte],id,id[],name,alias,description,relatedDummy.name,relatedDummy.name[],relatedDummies,relatedDummies[],dummy,relatedDummies.name,properties[]}",
"hydra:template": "/dummies{?dummyBoolean,relatedDummy.embeddedDummy.dummyBoolean,dummyDate[before],dummyDate[strictly_before],dummyDate[after],dummyDate[strictly_after],relatedDummy.dummyDate[before],relatedDummy.dummyDate[strictly_before],relatedDummy.dummyDate[after],relatedDummy.dummyDate[strictly_after],description[exists],relatedDummy.name[exists],dummyBoolean[exists],relatedDummy[exists],dummyFloat,dummyPrice,order[id],order[name],order[description],order[relatedDummy.name],order[relatedDummy.symfony],order[dummyDate],dummyFloat[between],dummyFloat[gt],dummyFloat[gte],dummyFloat[lt],dummyFloat[lte],dummyPrice[between],dummyPrice[gt],dummyPrice[gte],dummyPrice[lt],dummyPrice[lte],id,id[],name,alias,description,relatedDummy.name,relatedDummy.name[],relatedDummies,relatedDummies[],dummy,relatedDummies.name,properties[]}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
Expand Down Expand Up @@ -487,6 +487,12 @@ Feature: Date filter on collections
"property": "dummyBoolean",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "relatedDummy[exists]",
"property": "relatedDummy",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "dummyFloat",
Expand Down Expand Up @@ -721,7 +727,7 @@ Feature: Date filter on collections
},
"hydra:search": {
"@type": "hydra:IriTemplate",
"hydra:template": "/dummies{?dummyBoolean,dummyDate[before],dummyDate[after],relatedDummy.dummyDate[before],relatedDummy.dummyDate[strictly_before],relatedDummy.dummyDate[after],relatedDummy.dummyDate[strictly_after],description[exists],relatedDummy.name[exists],dummyBoolean[exists],dummyFloat,dummyPrice,order[id],order[name],order[relatedDummy.symfony],dummyFloat[between],dummyFloat[gt],dummyFloat[gte],dummyFloat[lt],dummyFloat[lte],dummyPrice[between],dummyPrice[gt],dummyPrice[gte],dummyPrice[lt],dummyPrice[lte],id,id[],name,alias,description,relatedDummy.name,relatedDummy.name[],relatedDummies,relatedDummies[],dummy,relatedDummies.name}",
"hydra:template": "/dummies{?dummyBoolean,dummyDate[before],dummyDate[after],relatedDummy.dummyDate[before],relatedDummy.dummyDate[strictly_before],relatedDummy.dummyDate[after],relatedDummy.dummyDate[strictly_after],description[exists],relatedDummy.name[exists],dummyBoolean[exists],relatedDummy[exists],dummyFloat,dummyPrice,order[id],order[name],order[relatedDummy.symfony],dummyFloat[between],dummyFloat[gt],dummyFloat[gte],dummyFloat[lt],dummyFloat[lte],dummyPrice[between],dummyPrice[gt],dummyPrice[gte],dummyPrice[lt],dummyPrice[lte],id,id[],name,alias,description,relatedDummy.name,relatedDummy.name[],relatedDummies,relatedDummies[],dummy,relatedDummies.name}",
"hydra:variableRepresentation": "BasicRepresentation",
"hydra:mapping": [
{
Expand Down Expand Up @@ -790,6 +796,12 @@ Feature: Date filter on collections
"property": "relatedDummy.name",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "relatedDummy[exists]",
"property": "relatedDummy",
"required": false
},
{
"@type": "IriTemplateMapping",
"variable": "dummyBoolean[exists]",
Expand Down
Loading