From 2c31c87013a7820a4402f42ab17a241f3a6ba35a Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Tue, 29 Jan 2019 05:51:49 +0100 Subject: [PATCH 01/68] DevKit updates --- .travis.yml | 24 ++++++++++++------------ README.md | 38 ++++++++++++++++++++++---------------- composer.json | 8 ++++---- src/Resources/meta/LICENSE | 2 +- 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39aecd29..3112300b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,23 +26,23 @@ cache: - $HOME/.composer/cache/files env: - matrix: SYMFONY_VERSION=4.0.* + matrix: SYMFONY_VERSION=4.2.* global: - - SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" + - SYMFONY_DEPRECATIONS_HELPER="weak" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - - SYMFONY_PHPUNIT_VERSION=6 - - TEST_INSTALLATION=false + - KERNEL_CLASS=Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel + - SYMFONY_PHPUNIT_VERSION=5.7.26 matrix: include: - - php: 7.2 - env: SYMFONY_VERSION=4.0.* - - php: 7.1 - env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=2.8.* SYMFONY_DEPRECATIONS_HELPER=weak - - php: 7.2 - env: SYMFONY_VERSION=3.3.* - - php: 7.2 - env: SYMFONY_VERSION=3.4.* + - php: "7.3" + env: SYMFONY_VERSION="4.2.*" + - php: "7.2" + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION="3.4.*" SYMFONY_DEPRECATIONS_HELPER="weak" + - php: "7.3" + env: SYMFONY_VERSION="4.0.*" + - php: "7.3" + env: SYMFONY_VERSION="4.1.*" fast_finish: true allow_failures: diff --git a/README.md b/README.md index 980af1ae..0b285495 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,11 @@ [![Monthly Downloads](https://poser.pugx.org/symfony-cmf/routing-bundle/d/monthly)](https://packagist.org/packages/symfony-cmf/routing-bundle) [![Daily Downloads](https://poser.pugx.org/symfony-cmf/routing-bundle/d/daily)](https://packagist.org/packages/symfony-cmf/routing-bundle) -Version/Branch | Travis | Coveralls | ------- | ------ | --------- | -2.1.1 | [![Build Status][travis_stable_badge]][travis_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | -master | [![Build Status][travis_unstable_badge]][travis_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | +Branch | Travis | Coveralls | Scrutinizer | +------ | ------ | --------- | ----------- | +3.0-dev | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_link] | +3.0-dev | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | [![Scrutinizer Status][scrutinizer_unstable_badge]][scrutinizer_unstable_link] | + This package is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). @@ -24,20 +25,20 @@ controller for redirection routes. ## Requirements -* PHP 7.1 / 7.2 -* Symfony 2.8 / 3.3 / 3.4 / 4.0 +* PHP 7.2 / 7.3 +* Symfony 3.4 / 4.0 / 4.1 / 4.2 * See also the `require` section of [composer.json](composer.json) ## Documentation For the install guide and reference, see: -* [symfony-cmf/routing-bundle Documentation](http://symfony.com/doc/master/cmf/bundles/routing/index.html) +* [symfony-cmf/routing-bundle Documentation](https://symfony.com/doc/master/cmf/bundles/routing/index.html) See also: -* [All Symfony CMF documentation](http://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference -* [Symfony CMF Website](http://cmf.symfony.com/) - introduction, live demo, support and community links +* [All Symfony CMF documentation](https://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference +* [Symfony CMF Website](https://cmf.symfony.com/) - introduction, live demo, support and community links ## Support @@ -60,12 +61,17 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=2.x -[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=master +[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=3.0-dev +[travis_stable_link]: https://travis-ci.org/symfony-cmf/routing-bundle +[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=3.0-dev +[travis_unstable_link]: https://travis-ci.org/symfony-cmf/routing-bundle -[travis_link]: https://travis-ci.org/symfony-cmf/routing-bundle +[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=3.0-dev +[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=3.0-dev +[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=3.0-dev +[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=3.0-dev -[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=2.x -[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=2.x -[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=master -[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=master +[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=3.0-dev +[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=3.0-dev +[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=3.0-dev +[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=3.0-dev diff --git a/composer.json b/composer.json index e9f0dce8..3da9bc11 100644 --- a/composer.json +++ b/composer.json @@ -15,20 +15,20 @@ } ], "require": { - "php": "^7.1", + "php": "^7.2", "symfony-cmf/routing": "^2.1.0", - "symfony/framework-bundle": "^2.8 || ^3.3 || ^4.0", + "symfony/framework-bundle": "^3.4 || ^4.0", "twig/twig": "^1.35 || ^2.4.4" }, "require-dev": { "doctrine/phpcr-odm": "^1.4|^2.0", - "symfony/phpunit-bridge": "^4.2.2", + "symfony/phpunit-bridge": "^3.4 || ^4.0", "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", "matthiasnoback/symfony-config-test": "^3.1.1", "doctrine/orm": "^2.5", "symfony-cmf/testing": "^2.1.11", "doctrine/data-fixtures": "^1.0.0", - "symfony/validator": "^2.8 || ^3.3 || ^4.0" + "symfony/validator": "^3.4 || ^4.0" }, "suggest": { "doctrine/phpcr-odm": "To enable support for the PHPCR ODM documents (^1.4)", diff --git a/src/Resources/meta/LICENSE b/src/Resources/meta/LICENSE index a1cf86ee..38a9702f 100644 --- a/src/Resources/meta/LICENSE +++ b/src/Resources/meta/LICENSE @@ -1,4 +1,4 @@ -Symfony Cmf Routing Bundle +Symfony CMF Routing Bundle The MIT License From 9dca91d9b5f00b0ec970f2ef71545227e112e4ff Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Tue, 29 Jan 2019 06:14:50 +0100 Subject: [PATCH 02/68] DevKit updates --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0b285495..c482926b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Branch | Travis | Coveralls | Scrutinizer | 3.0-dev | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | [![Scrutinizer Status][scrutinizer_unstable_badge]][scrutinizer_unstable_link] | -This package is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed +This package is part of the [Symfony Content Management Framework (CMF)](https://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). The RoutingBundle enables the @@ -42,7 +42,7 @@ See also: ## Support -For general support and questions, please use [StackOverflow](http://stackoverflow.com/questions/tagged/symfony-cmf). +For general support and questions, please use [StackOverflow](https://stackoverflow.com/questions/tagged/symfony-cmf). ## Contributing @@ -51,7 +51,7 @@ Pull requests are welcome. Please see our guide. Unit and/or functional tests exist for this package. See the -[Testing documentation](http://symfony.com/doc/master/cmf/components/testing.html) +[Testing documentation](https://symfony.com/doc/master/cmf/components/testing.html) for a guide to running the tests. Thanks to From 0d8c215db8d8f4b537859fb1543731e08e0087c6 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Tue, 29 Jan 2019 06:29:15 +0100 Subject: [PATCH 03/68] DevKit updates --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3112300b..44935d4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,13 +36,13 @@ env: matrix: include: - php: "7.3" - env: SYMFONY_VERSION="4.2.*" + env: STABILITY="dev" SYMFONY_VERSION="4.2.*" - php: "7.2" env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION="3.4.*" SYMFONY_DEPRECATIONS_HELPER="weak" - php: "7.3" - env: SYMFONY_VERSION="4.0.*" + env: STABILITY="dev" SYMFONY_VERSION="4.0.*" - php: "7.3" - env: SYMFONY_VERSION="4.1.*" + env: STABILITY="dev" SYMFONY_VERSION="4.1.*" fast_finish: true allow_failures: From af1b1ac6cb5169446022af267f6963eca0a1f00a Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Tue, 29 Jan 2019 06:38:28 +0100 Subject: [PATCH 04/68] DevKit updates --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c482926b..454dc298 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Branch | Travis | Coveralls | Scrutinizer | ------ | ------ | --------- | ----------- | -3.0-dev | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_link] | +b | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_link] | 3.0-dev | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | [![Scrutinizer Status][scrutinizer_unstable_badge]][scrutinizer_unstable_link] | @@ -61,17 +61,17 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=3.0-dev +[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=b [travis_stable_link]: https://travis-ci.org/symfony-cmf/routing-bundle [travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=3.0-dev [travis_unstable_link]: https://travis-ci.org/symfony-cmf/routing-bundle -[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=3.0-dev -[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=3.0-dev +[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=b +[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=b [coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=3.0-dev [coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=3.0-dev -[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=3.0-dev -[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=3.0-dev +[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=b +[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=b [scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=3.0-dev [scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=3.0-dev From 566d6c04414c819898ca3cae4a77a23407244446 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Tue, 29 Jan 2019 06:38:51 +0100 Subject: [PATCH 05/68] DevKit updates --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 454dc298..8f0bc2ff 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Branch | Travis | Coveralls | Scrutinizer | ------ | ------ | --------- | ----------- | -b | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_link] | +2.1 | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_link] | 3.0-dev | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | [![Scrutinizer Status][scrutinizer_unstable_badge]][scrutinizer_unstable_link] | @@ -61,17 +61,17 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=b +[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=2.1 [travis_stable_link]: https://travis-ci.org/symfony-cmf/routing-bundle [travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=3.0-dev [travis_unstable_link]: https://travis-ci.org/symfony-cmf/routing-bundle -[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=b -[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=b +[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=2.1 +[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=2.1 [coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=3.0-dev [coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=3.0-dev -[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=b -[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=b +[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=2.1 +[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=2.1 [scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=3.0-dev [scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=3.0-dev From 1d446026de09b8a98b0ce537264a140e9c19fe71 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 05:29:39 +0100 Subject: [PATCH 06/68] DevKit updates --- .travis.yml | 15 +++++++-------- README.md | 2 +- composer.json | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 44935d4e..ef4e8c43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ language: php php: - - 7.1 + - "7.1" sudo: false @@ -26,25 +26,24 @@ cache: - $HOME/.composer/cache/files env: - matrix: SYMFONY_VERSION=4.2.* + matrix: SYMFONY_VERSION="4.2.*" global: - SYMFONY_DEPRECATIONS_HELPER="weak" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - - KERNEL_CLASS=Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel - - SYMFONY_PHPUNIT_VERSION=5.7.26 + - KERNEL_CLASS="Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel" + - SYMFONY_PHPUNIT_VERSION="6" matrix: include: - php: "7.3" env: STABILITY="dev" SYMFONY_VERSION="4.2.*" - - php: "7.2" + - php: "7.1" env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION="3.4.*" SYMFONY_DEPRECATIONS_HELPER="weak" - - php: "7.3" + - php: "7.2" env: STABILITY="dev" SYMFONY_VERSION="4.0.*" - - php: "7.3" + - php: "7.2" env: STABILITY="dev" SYMFONY_VERSION="4.1.*" fast_finish: true - allow_failures: before_install: - phpenv config-rm xdebug.ini || true diff --git a/README.md b/README.md index 8f0bc2ff..672ad4fe 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ controller for redirection routes. ## Requirements -* PHP 7.2 / 7.3 +* PHP 7.1 / 7.2 / 7.3 * Symfony 3.4 / 4.0 / 4.1 / 4.2 * See also the `require` section of [composer.json](composer.json) diff --git a/composer.json b/composer.json index 3da9bc11..3db4edda 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.1", "symfony-cmf/routing": "^2.1.0", "symfony/framework-bundle": "^3.4 || ^4.0", "twig/twig": "^1.35 || ^2.4.4" From c3d587ae3b3ddd780901ad9bb44d5b9ed72451c3 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 05:41:45 +0100 Subject: [PATCH 07/68] DevKit updates --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3db4edda..040abeeb 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "php": "^7.1", "symfony-cmf/routing": "^2.1.0", "symfony/framework-bundle": "^3.4 || ^4.0", - "twig/twig": "^1.35 || ^2.4.4" + "twig/twig": "^1.35 || ^2.4.4", + "symfony/phpunit-bridge": "4.2.2" }, "require-dev": { "doctrine/phpcr-odm": "^1.4|^2.0", From e003c379e48573493c4c2966044646f621c06ee2 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 05:42:53 +0100 Subject: [PATCH 08/68] DevKit updates --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 040abeeb..bf2c3266 100644 --- a/composer.json +++ b/composer.json @@ -19,11 +19,11 @@ "symfony-cmf/routing": "^2.1.0", "symfony/framework-bundle": "^3.4 || ^4.0", "twig/twig": "^1.35 || ^2.4.4", - "symfony/phpunit-bridge": "4.2.2" + "symfony/phpunit-bridge": "^3.4 || ^4.0" }, "require-dev": { "doctrine/phpcr-odm": "^1.4|^2.0", - "symfony/phpunit-bridge": "^3.4 || ^4.0", + "symfony/phpunit-bridge": "4.2.2", "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", "matthiasnoback/symfony-config-test": "^3.1.1", "doctrine/orm": "^2.5", From 7ed160e7f98dd40952b4208d48c843a02c339611 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 30 Jan 2019 05:48:47 +0100 Subject: [PATCH 09/68] repair composer.json --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bf2c3266..21fe7a81 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,7 @@ "php": "^7.1", "symfony-cmf/routing": "^2.1.0", "symfony/framework-bundle": "^3.4 || ^4.0", - "twig/twig": "^1.35 || ^2.4.4", - "symfony/phpunit-bridge": "^3.4 || ^4.0" + "twig/twig": "^1.35 || ^2.4.4" }, "require-dev": { "doctrine/phpcr-odm": "^1.4|^2.0", From 2e8ab9f483c8ba98a9785f221c10f053a6736adf Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 06:00:25 +0100 Subject: [PATCH 10/68] DevKit updates --- .travis.yml | 5 ++++- travis.php.ini | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 travis.php.ini diff --git a/.travis.yml b/.travis.yml index ef4e8c43..517ddd02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,10 @@ before_install: - if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) -install: travis_wait composer update --prefer-dist $COMPOSER_FLAGS +install: + - phpenv config-add travis.php.ini + - php -ini | grep memory_limit + - travis_wait composer update --prefer-dist $COMPOSER_FLAGS script: - if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi diff --git a/travis.php.ini b/travis.php.ini new file mode 100644 index 00000000..7999e961 --- /dev/null +++ b/travis.php.ini @@ -0,0 +1 @@ +memory_limit = -1 From 1009440ee2f321ca99a43118286dfd613bb1dfa4 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 06:05:03 +0100 Subject: [PATCH 11/68] DevKit updates --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 21fe7a81..04255141 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "doctrine/phpcr-odm": "^1.4|^2.0", - "symfony/phpunit-bridge": "4.2.2", + "symfony/phpunit-bridge": "^4.2.2", "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", "matthiasnoback/symfony-config-test": "^3.1.1", "doctrine/orm": "^2.5", From 0a69604c599b5373c1b3756c46a978f257c402fa Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 08:49:57 +0100 Subject: [PATCH 12/68] DevKit updates --- .travis.yml | 12 ++++++++---- Makefile | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 517ddd02..21d0dae7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,20 +30,24 @@ env: global: - SYMFONY_DEPRECATIONS_HELPER="weak" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - - KERNEL_CLASS="Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel" - SYMFONY_PHPUNIT_VERSION="6" matrix: include: - php: "7.3" - env: STABILITY="dev" SYMFONY_VERSION="4.2.*" + env: STABILITY="dev" SYMFONY_VERSION="4.3.*" + - php: "7.3" + env: SYMFONY_VERSION="4.2.*" - php: "7.1" env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION="3.4.*" SYMFONY_DEPRECATIONS_HELPER="weak" - php: "7.2" - env: STABILITY="dev" SYMFONY_VERSION="4.0.*" + env: SYMFONY_VERSION="4.0.*" - php: "7.2" - env: STABILITY="dev" SYMFONY_VERSION="4.1.*" + env: SYMFONY_VERSION="4.1.*" fast_finish: true + allow_failures: + - php: "7.3" + env: STABILITY=dev SYMFONY_VERSION="4.3.*" before_install: - phpenv config-rm xdebug.ini || true diff --git a/Makefile b/Makefile index d0ffc9dc..c5d5ca28 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ ifdef BRANCH VERSION=dev-${BRANCH} endif PACKAGE=symfony-cmf/routing-bundle -export KERNEL_CLASS=Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel + list: @echo 'test: will run all tests' @echo 'unit_tests: will run unit tests only' From 1af73a1ba19e9b8227521229f5d3ccd634ecd0b8 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 08:53:26 +0100 Subject: [PATCH 13/68] DevKit updates --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 672ad4fe..dcc48a3f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Branch | Travis | Coveralls | Scrutinizer | ------ | ------ | --------- | ----------- | 2.1 | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_link] | -3.0-dev | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | [![Scrutinizer Status][scrutinizer_unstable_badge]][scrutinizer_unstable_link] | +dev-master | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | [![Scrutinizer Status][scrutinizer_unstable_badge]][scrutinizer_unstable_link] | This package is part of the [Symfony Content Management Framework (CMF)](https://cmf.symfony.com/) and licensed @@ -63,15 +63,15 @@ This package is available under the [MIT license](src/Resources/meta/LICENSE). [travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=2.1 [travis_stable_link]: https://travis-ci.org/symfony-cmf/routing-bundle -[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=3.0-dev +[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-bundle.svg?branch=dev-master [travis_unstable_link]: https://travis-ci.org/symfony-cmf/routing-bundle [coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=2.1 [coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=2.1 -[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=3.0-dev -[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=3.0-dev +[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-bundle/badge.svg?branch=dev-master +[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-bundle?branch=dev-master [scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=2.1 [scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=2.1 -[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=3.0-dev -[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=3.0-dev +[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/badges/quality-score.png?b=dev-master +[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-bundle/?branch=dev-master From 7957521923de516caabf17cf03679058dde0d8ce Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 08:57:40 +0100 Subject: [PATCH 14/68] DevKit updates --- .travis.yml | 3 +++ Makefile | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 21d0dae7..cefec79a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ env: - SYMFONY_DEPRECATIONS_HELPER="weak" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - SYMFONY_PHPUNIT_VERSION="6" + - TEST_INSTALLATION=false matrix: include: @@ -44,10 +45,12 @@ matrix: env: SYMFONY_VERSION="4.0.*" - php: "7.2" env: SYMFONY_VERSION="4.1.*" + - env: TEST_INSTALLATION=true fast_finish: true allow_failures: - php: "7.3" env: STABILITY=dev SYMFONY_VERSION="4.3.*" + - env: TEST_INSTALLATION=true before_install: - phpenv config-rm xdebug.ini || true diff --git a/Makefile b/Makefile index c5d5ca28..8f93e4d6 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,11 @@ list: @echo 'unit_tests: will run unit tests only' @echo 'functional_tests_phpcr: will run functional tests with PHPCR' @echo 'functional_tests_orm: will run functional tests with ORM' - + @echo 'test_installation: will run installation test' include ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk include ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk include ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk +include ${TESTING_SCRIPTS_DIR}/make/test_installation.mk .PHONY: test test: unit_tests functional_tests_phpcr functional_tests_orm From 7d0d24ad5dfe9b0c2d7ddddea4648d8e9a979075 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 22:53:43 +0100 Subject: [PATCH 15/68] DevKit updates --- .travis.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index cefec79a..9e859c6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,9 @@ language: php php: - - "7.1" - + - 7.1 + - 7.2 + - 7.3 sudo: false cache: @@ -26,30 +27,30 @@ cache: - $HOME/.composer/cache/files env: - matrix: SYMFONY_VERSION="4.2.*" + matrix: SYMFONY_VERSION=4.2.* global: - - SYMFONY_DEPRECATIONS_HELPER="weak" + - SYMFONY_DEPRECATIONS_HELPER=weak - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - - SYMFONY_PHPUNIT_VERSION="6" + - SYMFONY_PHPUNIT_VERSION=7 - TEST_INSTALLATION=false matrix: include: - - php: "7.3" - env: STABILITY="dev" SYMFONY_VERSION="4.3.*" - - php: "7.3" - env: SYMFONY_VERSION="4.2.*" - - php: "7.1" - env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION="3.4.*" SYMFONY_DEPRECATIONS_HELPER="weak" - - php: "7.2" - env: SYMFONY_VERSION="4.0.*" - - php: "7.2" - env: SYMFONY_VERSION="4.1.*" + - php: 7.3 + env: STABILITY="dev" SYMFONY_VERSION=4.3.* + - php: 7.3 + env: SYMFONY_VERSION=4.2.* + - php: 7.1 + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER=weak + - php: 7.2 + env: SYMFONY_VERSION=4.0.* + - php: 7.2 + env: SYMFONY_VERSION=4.1.* - env: TEST_INSTALLATION=true fast_finish: true allow_failures: - - php: "7.3" - env: STABILITY=dev SYMFONY_VERSION="4.3.*" + - php: 7.3 + env: STABILITY="dev" SYMFONY_VERSION=4.3.* - env: TEST_INSTALLATION=true before_install: From bb4bd879d7615361f32eb2864600c92be80d4425 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 30 Jan 2019 23:38:26 +0100 Subject: [PATCH 16/68] lower versions --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 04255141..76551b73 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ "require-dev": { "doctrine/phpcr-odm": "^1.4|^2.0", "symfony/phpunit-bridge": "^4.2.2", - "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", - "matthiasnoback/symfony-config-test": "^3.1.1", + "matthiasnoback/symfony-dependency-injection-test": "^1.1", + "matthiasnoback/symfony-config-test": "^2.1", "doctrine/orm": "^2.5", "symfony-cmf/testing": "^2.1.11", "doctrine/data-fixtures": "^1.0.0", From 2a385191480df60879c80c1569649214b933ebaf Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 30 Jan 2019 23:39:11 +0100 Subject: [PATCH 17/68] fix after merge --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9e859c6d..ea57ec24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ env: global: - SYMFONY_DEPRECATIONS_HELPER=weak - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - - SYMFONY_PHPUNIT_VERSION=7 + - SYMFONY_PHPUNIT_VERSION=6 - TEST_INSTALLATION=false matrix: From 721a46dfe686e8a77ace0869f5f5d5b8221d5d42 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 30 Jan 2019 23:40:22 +0100 Subject: [PATCH 18/68] back to other version --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 76551b73..04255141 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ "require-dev": { "doctrine/phpcr-odm": "^1.4|^2.0", "symfony/phpunit-bridge": "^4.2.2", - "matthiasnoback/symfony-dependency-injection-test": "^1.1", - "matthiasnoback/symfony-config-test": "^2.1", + "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", + "matthiasnoback/symfony-config-test": "^3.1.1", "doctrine/orm": "^2.5", "symfony-cmf/testing": "^2.1.11", "doctrine/data-fixtures": "^1.0.0", From 1574b05603c9d8bd9b558d1e16b15ba4ed0cc5a2 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 23:42:26 +0100 Subject: [PATCH 19/68] DevKit updates --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 8f93e4d6..e11a537d 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,12 @@ ############################################################################ TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin + +SYMFONY_PHPUNIT_VERSION=6 +SYMFONY_DEPRECATIONS_HELPER==weak CONSOLE=${TESTING_SCRIPTS_DIR}/console +SYMFONY_PHPUNIT_DIR=.phpunit +SYMFONY_PHPUNIT_REMOVE="symfony/yaml" VERSION=dev-master ifdef BRANCH VERSION=dev-${BRANCH} From 41318e32ad99bada9a09fc600b7471fa451ddee5 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 31 Jan 2019 01:10:42 +0100 Subject: [PATCH 20/68] add root node --- src/DependencyInjection/Configuration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 9b01dc5b..7ce730a6 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -33,8 +33,8 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $root = $treeBuilder->root('cmf_routing'); + $treeBuilder = new TreeBuilder('cmf_routing'); + $root = $treeBuilder->getRootNode(); $this->addChainSection($root); $this->addDynamicSection($root); From 85f3d811f7d17144344691f731bffa6e2e6a7c2b Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Mon, 4 Feb 2019 09:18:32 +0100 Subject: [PATCH 21/68] DevKit updates --- .travis.yml | 4 ++-- Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea57ec24..1f3a4639 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ cache: env: matrix: SYMFONY_VERSION=4.2.* global: - - SYMFONY_DEPRECATIONS_HELPER=weak + - SYMFONY_DEPRECATIONS_HELPER=/.*each.*/ - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - SYMFONY_PHPUNIT_VERSION=6 - TEST_INSTALLATION=false @@ -41,7 +41,7 @@ matrix: - php: 7.3 env: SYMFONY_VERSION=4.2.* - php: 7.1 - env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER=weak + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER=/.*each.*/ - php: 7.2 env: SYMFONY_VERSION=4.0.* - php: 7.2 diff --git a/Makefile b/Makefile index e11a537d..b1be3975 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin SYMFONY_PHPUNIT_VERSION=6 -SYMFONY_DEPRECATIONS_HELPER==weak +SYMFONY_DEPRECATIONS_HELPER==/.*each.*/ CONSOLE=${TESTING_SCRIPTS_DIR}/console SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" From 535d2185d186aad1e48f0ad47a314614abafd0f9 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Mon, 4 Feb 2019 09:33:45 +0100 Subject: [PATCH 22/68] root node defintion for SF < 4.2 also --- src/DependencyInjection/Configuration.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 7ce730a6..8fae0d1c 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -34,10 +34,16 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('cmf_routing'); - $root = $treeBuilder->getRootNode(); + // Keep compatibility with symfony/config < 4.2 + if (!method_exists($treeBuilder, 'getRootNode')) { + $rootNode = $treeBuilder->root('cmf_routing'); + } else { + $rootNode = $treeBuilder->getRootNode(); + } - $this->addChainSection($root); - $this->addDynamicSection($root); + + $this->addChainSection($rootNode); + $this->addDynamicSection($rootNode); return $treeBuilder; } From a01b7c1a47618ad00b6f8a378d31d9e309525aa2 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Mon, 4 Feb 2019 09:56:26 +0100 Subject: [PATCH 23/68] DevKit updates --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f3a4639..bbeb2907 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ cache: env: matrix: SYMFONY_VERSION=4.2.* global: - - SYMFONY_DEPRECATIONS_HELPER=/.*each.*/ + - SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - SYMFONY_PHPUNIT_VERSION=6 - TEST_INSTALLATION=false @@ -41,7 +41,8 @@ matrix: - php: 7.3 env: SYMFONY_VERSION=4.2.* - php: 7.1 - env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER=/.*each.*/ + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" + - php: 7.2 env: SYMFONY_VERSION=4.0.* - php: 7.2 From 979e442cbf2e0cf7c8c55d7111ded2c6ad70a232 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 06:26:13 +0100 Subject: [PATCH 24/68] DevKit updates --- .php_cs | 3 +++ Makefile | 23 ++++++++++++----- php_cs.dist | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ phpunit.xml.dist | 39 ++++++++++++++++------------ 4 files changed, 109 insertions(+), 23 deletions(-) create mode 100644 .php_cs create mode 100644 php_cs.dist diff --git a/.php_cs b/.php_cs new file mode 100644 index 00000000..97adafa4 --- /dev/null +++ b/.php_cs @@ -0,0 +1,3 @@ + true, + '@Symfony:risky' => true, + 'array_syntax' => [ + 'syntax' => 'short', + ], + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'header_comment' => [ + 'header' => $header, + ], + 'no_extra_blank_lines' => true, + 'no_php4_constructor' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'ordered_class_elements' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + '@PHP56Migration' => true, + '@PHP56Migration:risky' => true, + '@PHPUnit57Migration:risky' => true, + '@PHP70Migration' => true, + '@PHP70Migration:risky' => true, + '@PHPUnit60Migration:risky' => true, + '@PHP71Migration' => true, + '@PHP71Migration:risky' => true, + 'compact_nullable_typehint' => true, + 'void_return' => null, + 'strict_comparison' => true, + 'strict_param' => true, + 'php_unit_strict' => true, +]; + + +$finder = PhpCsFixer\Finder::create() + ->in(__DIR__) + ->exclude('Tests/Fixtures') + ->exclude('tests/Fixtures') + ->exclude('Resources/skeleton') + ->exclude('Resources/public/vendor') +; + +return PhpCsFixer\Config::create() + ->setFinder($finder) + ->setRiskyAllowed(true) + ->setRules($rules) + ->setUsingCache(true) +; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 48c2d117..75ae949a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,35 +2,40 @@ - - + + + ./tests/Unit + ./tests/Functional ./tests/Functional/Doctrine/Orm + ./tests/Functional/Doctrine/Orm - - - - - src/ - - Resources/ - - - - - + + + + + + src/ + + Resources/ + + + + + + - + From 9fa3b5f032f35587abe3040893c8eaf38e8bc50d Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 06:28:09 +0100 Subject: [PATCH 25/68] DevKit updates --- phpunit.xml.dist | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 75ae949a..d5a592d7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,23 +7,22 @@ > + ./tests/Unit - ./tests/Functional ./tests/Functional/Doctrine/Orm - ./tests/Functional/Doctrine/Orm - - + + From f7147a96985e6458de8bf88bfce5406768a9804d Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 06:33:15 +0100 Subject: [PATCH 26/68] DevKit updates --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index bbeb2907..7b96b130 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,10 +32,11 @@ env: - SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - SYMFONY_PHPUNIT_VERSION=6 - - TEST_INSTALLATION=false + - TARGET=test matrix: include: + - env: TARGET=lint - php: 7.3 env: STABILITY="dev" SYMFONY_VERSION=4.3.* - php: 7.3 @@ -47,12 +48,12 @@ matrix: env: SYMFONY_VERSION=4.0.* - php: 7.2 env: SYMFONY_VERSION=4.1.* - - env: TEST_INSTALLATION=true + - env: TARGET=test_installation fast_finish: true allow_failures: - php: 7.3 env: STABILITY="dev" SYMFONY_VERSION=4.3.* - - env: TEST_INSTALLATION=true + - env: TARGET=test_installation before_install: - phpenv config-rm xdebug.ini || true @@ -66,8 +67,7 @@ install: - phpenv config-add travis.php.ini - php -ini | grep memory_limit - travis_wait composer update --prefer-dist $COMPOSER_FLAGS -script: - - if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi +script: make $TARGET notifications: irc: "irc.freenode.org#symfony-cmf" From 506f87350a69fbfd07ccccb37cb769f10fc74c04 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 06:36:52 +0100 Subject: [PATCH 27/68] DevKit updates --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ab695ed5..a333fc3f 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,14 @@ lint-php: php-cs-fixer fix --ansi --verbose --diff --dry-run .PHONY: lint-php -cs-fix: cs-fix-php cs-fix-xml +int: lint-composer lint-php +.PHONY: lint + +lint-composer: + composer validate +.PHONY: lint-composer + +cs-fix: cs-fix-php .PHONY: cs-fix cs-fix-php: From 27f174dff927abacc57136d9bd2cd9516de49f2e Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 06:47:06 +0100 Subject: [PATCH 28/68] DevKit updates --- .travis.yml | 3 ++- .travis/install_lint.sh | 11 +++++++++++ .travis/install_test.sh | 19 +++++++++++++++++++ Makefile | 3 +++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 .travis/install_lint.sh create mode 100755 .travis/install_test.sh diff --git a/.travis.yml b/.travis.yml index 7b96b130..67696030 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,8 @@ before_install: install: - phpenv config-add travis.php.ini - php -ini | grep memory_limit - - travis_wait composer update --prefer-dist $COMPOSER_FLAGS + - if [ -x .travis/install_${TARGET}.sh ]; then .travis/install_${TARGET}.sh; fi; + script: make $TARGET notifications: diff --git a/.travis/install_lint.sh b/.travis/install_lint.sh new file mode 100755 index 00000000..864c751e --- /dev/null +++ b/.travis/install_lint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh +set -ev + +mkdir --parents "${HOME}/bin" + +wget "http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar" --output-document="${HOME}/bin/php-cs-fixer" +chmod u+x "${HOME}/bin/php-cs-fixer" + +composer global require sllh/composer-lint:@stable --prefer-dist --no-interaction + +gem install yaml-lint diff --git a/.travis/install_test.sh b/.travis/install_test.sh new file mode 100755 index 00000000..a0335009 --- /dev/null +++ b/.travis/install_test.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +set -ev + +mkdir --parents "${HOME}/bin" + +wget "https://phar.phpunit.de/phpunit-${PHPUNIT_VERSION}.phar" --output-document="${HOME}/bin/phpunit" +chmod u+x "${HOME}/bin/phpunit" + +# Coveralls client install +wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar --output-document="${HOME}/bin/coveralls" +chmod u+x "${HOME}/bin/coveralls" + +# To be removed when these issues are resolved: +# https://github.com/composer/composer/issues/5355 +if [ "${COMPOSER_FLAGS}" = '--prefer-lowest' ]; then + composer update --prefer-dist --no-interaction --prefer-stable --quiet +fi + +composer update --prefer-dist --no-interaction --prefer-stable ${COMPOSER_FLAGS} diff --git a/Makefile b/Makefile index a333fc3f..220ee00d 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,9 @@ cs-fix-php: php-cs-fixer fix --verbose .PHONY: cs-fix-php +build: + mkdir $@ + build/xdebug-filter.php: phpunit.xml.dist build ifeq ($(HAS_XDEBUG), 0) phpunit --dump-xdebug-filter $@ From 960e7c1a5d877ea1f27ea70d5ffb585fc75e8342 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 06:50:24 +0100 Subject: [PATCH 29/68] DevKit updates --- .travis.yml | 3 +++ .travis/after_success_test.sh | 5 +++++ 2 files changed, 8 insertions(+) create mode 100755 .travis/after_success_test.sh diff --git a/.travis.yml b/.travis.yml index 67696030..67f5190b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,5 +70,8 @@ install: script: make $TARGET +after_success: + - if [ -x .travis/after_success_${TARGET}.sh ]; then .travis/after_success_${TARGET}.sh; fi; + notifications: irc: "irc.freenode.org#symfony-cmf" diff --git a/.travis/after_success_test.sh b/.travis/after_success_test.sh new file mode 100755 index 00000000..98374202 --- /dev/null +++ b/.travis/after_success_test.sh @@ -0,0 +1,5 @@ + +#!/usr/bin/env sh +set -ev + +coveralls -v From f4bcd2929df784f11088d05df8ed40a00e6dab0c Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 06:54:16 +0100 Subject: [PATCH 30/68] DevKit updates --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 67f5190b..a6e5ef18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ env: - SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - SYMFONY_PHPUNIT_VERSION=6 + - PHPUNIT_VERSION=6 - TARGET=test matrix: From d23ae5b8a71b6c0da7085a3d47785dea50c0d4b9 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 07:14:07 +0100 Subject: [PATCH 31/68] DevKit updates --- Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile b/Makefile index 220ee00d..188f61dc 100644 --- a/Makefile +++ b/Makefile @@ -28,9 +28,25 @@ list: @echo 'functional_tests_phpcr: will run functional tests with PHPCR' @echo 'functional_tests_orm: will run functional tests with ORM' @echo 'test_installation: will run installation test' +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)) + include $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) +endif include ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)) + include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) +endif include ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)) + include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) +endif include ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)) + include $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk) +endif include ${TESTING_SCRIPTS_DIR}/make/test_installation.mk .PHONY: test From 4b7b59e12b52dc2916352b058ba84e81ff6b9db4 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 07:40:55 +0100 Subject: [PATCH 32/68] DevKit updates --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index 188f61dc..a16c35a1 100644 --- a/Makefile +++ b/Makefile @@ -32,22 +32,18 @@ ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)) include $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) endif -include ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)) include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) endif -include ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)),) contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)) include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) endif -include ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)),) contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)) include $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk) endif -include ${TESTING_SCRIPTS_DIR}/make/test_installation.mk .PHONY: test test: build/xdebug-filter.php unit_tests functional_tests_phpcr functional_tests_orm From 3dd4174ab1889d00c062e3d0a482f07f2c6022b1 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 07:50:34 +0100 Subject: [PATCH 33/68] DevKit updates --- Makefile | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index a16c35a1..ef3f1498 100644 --- a/Makefile +++ b/Makefile @@ -28,22 +28,10 @@ list: @echo 'functional_tests_phpcr: will run functional tests with PHPCR' @echo 'functional_tests_orm: will run functional tests with ORM' @echo 'test_installation: will run installation test' -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)) - include $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) -endif -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)) - include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) -endif -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)) - include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) -endif -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)) - include $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk) -endif +include $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) +include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) +include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) +include $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk) .PHONY: test test: build/xdebug-filter.php unit_tests functional_tests_phpcr functional_tests_orm From 99dbcb05b46c4daf94c2982aa441a7140c0bdb2a Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 08:23:48 +0100 Subject: [PATCH 34/68] DevKit updates --- Makefile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ef3f1498..31ee89b7 100644 --- a/Makefile +++ b/Makefile @@ -28,10 +28,22 @@ list: @echo 'functional_tests_phpcr: will run functional tests with PHPCR' @echo 'functional_tests_orm: will run functional tests with ORM' @echo 'test_installation: will run installation test' -include $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) -include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) -include $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) -include $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk) +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)) + include ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk +endif +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)) + include ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk +endif +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)) + include ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk +endif +ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)),) + contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)) + include ${TESTING_SCRIPTS_DIR}/make/test_installation.mk +endif .PHONY: test test: build/xdebug-filter.php unit_tests functional_tests_phpcr functional_tests_orm From 4da8d7cb0426debe50094f0f57b7036322f09e40 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 08:30:25 +0100 Subject: [PATCH 35/68] DevKit updates --- Makefile | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 31ee89b7..5c957c43 100644 --- a/Makefile +++ b/Makefile @@ -28,21 +28,25 @@ list: @echo 'functional_tests_phpcr: will run functional tests with PHPCR' @echo 'functional_tests_orm: will run functional tests with ORM' @echo 'test_installation: will run installation test' -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)) - include ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk +EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/unit_tests.mk +ifneq ($(strip $(EXTRA_INCLUDES)),) + contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) + include $(EXTRA_INCLUDES) endif -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)) - include ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk +EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk +ifneq ($(strip $(EXTRA_INCLUDES)),) + contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) + include $(EXTRA_INCLUDES) endif -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)) - include ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk +EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk +ifneq ($(strip $(EXTRA_INCLUDES)),) + contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) + include $(EXTRA_INCLUDES) endif -ifneq ($(strip $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)),) - contents := $(shell echo including extra rules $(${TESTING_SCRIPTS_DIR}/make/test_installation.mk)) - include ${TESTING_SCRIPTS_DIR}/make/test_installation.mk +EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/test_installation.mk +ifneq ($(strip $(EXTRA_INCLUDES)),) + contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) + include $(EXTRA_INCLUDES) endif .PHONY: test From 92ac823887c51e56a9539b746a4fa4841ba33d18 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 08:36:19 +0100 Subject: [PATCH 36/68] DevKit updates --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5c957c43..3199204c 100644 --- a/Makefile +++ b/Makefile @@ -28,22 +28,22 @@ list: @echo 'functional_tests_phpcr: will run functional tests with PHPCR' @echo 'functional_tests_orm: will run functional tests with ORM' @echo 'test_installation: will run installation test' -EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/unit_tests.mk +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) endif -EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) endif -EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) endif -EXTRA_INCLUDES:=${TESTING_SCRIPTS_DIR}/make/test_installation.mk +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/test_installation.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) From e2ca86ef6f8d6f1dbd94498a5fa8016bdb6406c4 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 08:42:02 +0100 Subject: [PATCH 37/68] DevKit updates --- Makefile | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3199204c..64263b13 100644 --- a/Makefile +++ b/Makefile @@ -27,30 +27,49 @@ list: @echo 'unit_tests: will run unit tests only' @echo 'functional_tests_phpcr: will run functional tests with PHPCR' @echo 'functional_tests_orm: will run functional tests with ORM' - @echo 'test_installation: will run installation test' + @echo 'test_installation: will run installation test'TEST_DEPENDENCIES := "" EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) -endif + TEST_DEPENDENCIES := $(TEST_DEPENDENCIES)" unit_tests" + endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) -endif + TEST_DEPENDENCIES := $(TEST_DEPENDENCIES)" functional_tests_phpcr" + endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) -endif + TEST_DEPENDENCIES := $(TEST_DEPENDENCIES)" functional_tests_orm" + endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/test_installation.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) contents := $(shell echo including extra rules $(EXTRA_INCLUDES)) include $(EXTRA_INCLUDES) -endif + endif .PHONY: test -test: build/xdebug-filter.php unit_tests functional_tests_phpcr functional_tests_orm +test: build/xdebug-filter.php$ +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) +ifneq ($(strip $(EXTRA_INCLUDES)),) + - unit_tests + endif +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) +ifneq ($(strip $(EXTRA_INCLUDES)),) + - functional_tests_phpcr + endif +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) +ifneq ($(strip $(EXTRA_INCLUDES)),) + - functional_tests_orm + endif +EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/test_installation.mk) +ifneq ($(strip $(EXTRA_INCLUDES)),) + endif + lint-php: php-cs-fixer fix --ansi --verbose --diff --dry-run .PHONY: lint-php From 2dd950143c0eb0ef9cdbcfaf732a139e8c21711d Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 08:42:59 +0100 Subject: [PATCH 38/68] DevKit updates --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 64263b13..721bbdcc 100644 --- a/Makefile +++ b/Makefile @@ -56,15 +56,15 @@ ifneq ($(strip $(EXTRA_INCLUDES)),) test: build/xdebug-filter.php$ EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) - - unit_tests + make unit_tests endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) - - functional_tests_phpcr + make functional_tests_phpcr endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) - - functional_tests_orm + make functional_tests_orm endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/test_installation.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) From 126b5030afebd9d75c867daec89bba9dbaec7e4c Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 08:45:31 +0100 Subject: [PATCH 39/68] DevKit updates --- Makefile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 721bbdcc..75edb41e 100644 --- a/Makefile +++ b/Makefile @@ -56,19 +56,16 @@ ifneq ($(strip $(EXTRA_INCLUDES)),) test: build/xdebug-filter.php$ EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) - make unit_tests - endif + make unit_tests +endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) - make functional_tests_phpcr - endif + make functional_tests_phpcr +endif EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) ifneq ($(strip $(EXTRA_INCLUDES)),) - make functional_tests_orm - endif -EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/test_installation.mk) -ifneq ($(strip $(EXTRA_INCLUDES)),) - endif + make functional_tests_orm +endif lint-php: php-cs-fixer fix --ansi --verbose --diff --dry-run From f2b5c40e3e8b8a3901f67edf29107cbb045b9381 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 08:50:08 +0100 Subject: [PATCH 40/68] DevKit updates --- Makefile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 75edb41e..31836870 100644 --- a/Makefile +++ b/Makefile @@ -54,17 +54,14 @@ ifneq ($(strip $(EXTRA_INCLUDES)),) .PHONY: test test: build/xdebug-filter.php$ -EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk) -ifneq ($(strip $(EXTRA_INCLUDES)),) - make unit_tests +ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) + @make unit_tests endif -EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk) -ifneq ($(strip $(EXTRA_INCLUDES)),) - make functional_tests_phpcr +ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) + @make functional_tests_phpcr endif -EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk) -ifneq ($(strip $(EXTRA_INCLUDES)),) - make functional_tests_orm +ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)),) + @make functional_tests_orm endif lint-php: From 7e24c17d35ebf5f53e55da57759f75f15528a2a6 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 09:03:15 +0100 Subject: [PATCH 41/68] DevKit updates --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 31836870..059448c7 100644 --- a/Makefile +++ b/Makefile @@ -55,13 +55,13 @@ ifneq ($(strip $(EXTRA_INCLUDES)),) .PHONY: test test: build/xdebug-filter.php$ ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) - @make unit_tests + @make unit_tests endif ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) - @make functional_tests_phpcr + @make functional_tests_phpcr endif ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_orm.mk)),) - @make functional_tests_orm + @make functional_tests_orm endif lint-php: From 6d5a19af43ae3ebb424929efcd02b186cb96c635 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 09:08:25 +0100 Subject: [PATCH 42/68] DevKit updates --- .php_cs.dist | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .php_cs.dist diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 00000000..bc0747fd --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,67 @@ + true, + '@Symfony:risky' => true, + 'array_syntax' => [ + 'syntax' => 'short', + ], + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'header_comment' => [ + 'header' => $header, + ], + 'no_extra_blank_lines' => true, + 'no_php4_constructor' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'ordered_class_elements' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + '@PHP56Migration' => true, + '@PHP56Migration:risky' => true, + '@PHPUnit57Migration:risky' => true, + '@PHP70Migration' => true, + '@PHP70Migration:risky' => true, + '@PHPUnit60Migration:risky' => true, + '@PHP71Migration' => true, + '@PHP71Migration:risky' => true, + 'compact_nullable_typehint' => true, + 'void_return' => null, + 'strict_comparison' => true, + 'strict_param' => true, + 'php_unit_strict' => true, +]; + + +$finder = PhpCsFixer\Finder::create() + ->in(__DIR__) + ->exclude('Tests/Fixtures') + ->exclude('tests/Fixtures') + ->exclude('Resources/skeleton') + ->exclude('Resources/public/vendor') +; + +return PhpCsFixer\Config::create() + ->setFinder($finder) + ->setRiskyAllowed(true) + ->setRules($rules) + ->setUsingCache(true) +; diff --git a/Makefile b/Makefile index 059448c7..f3a58808 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ lint-php: php-cs-fixer fix --ansi --verbose --diff --dry-run .PHONY: lint-php -int: lint-composer lint-php +lint: lint-composer lint-php .PHONY: lint lint-composer: From 923bf0d1d9e3b644080f2a16451000461aa20c1d Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 09:10:00 +0100 Subject: [PATCH 43/68] DevKit updates --- .php_cs.dist | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index bc0747fd..8488c0f6 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -7,14 +7,14 @@ */ $header = <<<'HEADER' -############################################################################ -# This file is part of the Symfony CMF package. # -# # -# (c) 2011-2017 Symfony CMF # -# # -# For the full copyright and license information, please view the LICENSE # -# file that was distributed with this source code. # -############################################################################ +/* + * This file is part of the Symfony CMF package. + * + * (c) Symfony CMF + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ HEADER; $rules = [ From 9763716c52618e30ea11678909a6739bc611f16b Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 8 Feb 2019 09:12:51 +0100 Subject: [PATCH 44/68] DevKit updates --- .php_cs.dist | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 8488c0f6..9ccddb21 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -7,14 +7,12 @@ */ $header = <<<'HEADER' -/* - * This file is part of the Symfony CMF package. - * - * (c) Symfony CMF - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +This file is part of the Symfony CMF package. + +(c) Symfony CMF + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. HEADER; $rules = [ From 556c273e0cc47977b3fd9c8601766cd8928fa502 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Mon, 4 Feb 2019 10:02:44 +0100 Subject: [PATCH 45/68] little bit higher php-odm version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 04255141..eb202ad2 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "twig/twig": "^1.35 || ^2.4.4" }, "require-dev": { - "doctrine/phpcr-odm": "^1.4|^2.0", + "doctrine/phpcr-odm": "^1.4.2 || ^2.0", "symfony/phpunit-bridge": "^4.2.2", "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", "matthiasnoback/symfony-config-test": "^3.1.1", From e04d7bcc16630de84b1cf00b2df0eec6dd9cc5c2 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sat, 9 Feb 2019 04:55:03 +0100 Subject: [PATCH 46/68] cs fixes --- src/CmfRoutingBundle.php | 2 + src/Controller/RedirectController.php | 2 + .../CmfRoutingExtension.php | 44 +++--- .../Compiler/SetRouterPass.php | 2 + .../Compiler/TemplatingValidatorPass.php | 2 + .../Compiler/ValidationPass.php | 2 + src/DependencyInjection/Configuration.php | 5 +- src/Doctrine/DoctrineProvider.php | 2 + src/Doctrine/Orm/ContentRepository.php | 32 ++--- src/Doctrine/Orm/Route.php | 2 + src/Doctrine/Orm/RouteProvider.php | 4 +- src/Doctrine/Phpcr/ContentRepository.php | 4 +- src/Doctrine/Phpcr/IdPrefixListener.php | 18 +-- src/Doctrine/Phpcr/LocaleListener.php | 4 +- src/Doctrine/Phpcr/PrefixCandidates.php | 6 +- src/Doctrine/Phpcr/PrefixInterface.php | 2 + src/Doctrine/Phpcr/RedirectRoute.php | 10 +- src/Doctrine/Phpcr/Route.php | 18 +-- src/Doctrine/Phpcr/RouteProvider.php | 78 +++++------ .../RouteConditionMetadataListener.php | 4 +- src/Form/Type/RouteTypeType.php | 2 + src/Model/RedirectRoute.php | 2 + src/Model/Route.php | 28 ++-- src/Routing/DynamicRouter.php | 62 ++++----- src/Validator/Constraints/RouteDefaults.php | 2 + .../RouteDefaultsTemplatingValidator.php | 2 + .../RouteDefaultsTwigValidator.php | 2 + tests/Functional/BaseTestCase.php | 2 + .../Controller/RedirectControllerTest.php | 4 +- tests/Functional/Doctrine/Orm/OrmTestCase.php | 4 +- .../Doctrine/Orm/RouteProviderTest.php | 2 + .../Doctrine/Phpcr/RedirectRouteTest.php | 6 +- .../Doctrine/Phpcr/RouteProviderTest.php | 74 +++++----- tests/Functional/Doctrine/Phpcr/RouteTest.php | 36 ++--- .../Functional/Routing/DynamicRouterTest.php | 43 +++--- .../CmfRoutingExtensionTest.php | 16 ++- .../Compiler/SetRouterPassTest.php | 12 +- .../Compiler/TemplatingValidatorPassTest.php | 20 +-- .../Compiler/ValidationPassTest.php | 12 +- .../DependencyInjection/ConfigurationTest.php | 22 +-- .../DependencyInjection/XmlSchemaTest.php | 2 + .../Doctrine/Orm/ContentRepositoryTest.php | 2 + tests/Unit/Doctrine/Orm/RouteProviderTest.php | 2 + .../Doctrine/Phpcr/ContentRepositoryTest.php | 4 +- .../Doctrine/Phpcr/IdPrefixListenerTest.php | 36 ++--- .../Doctrine/Phpcr/LocaleListenerTest.php | 46 ++++--- .../Doctrine/Phpcr/PrefixCandidatesTest.php | 14 +- .../Unit/Doctrine/Phpcr/RouteProviderTest.php | 127 +++++++++--------- tests/Unit/Doctrine/Phpcr/RouteTest.php | 6 +- tests/Unit/Form/Type/RouteTypeTypeTest.php | 2 + tests/Unit/Routing/DynamicRouterTest.php | 24 ++-- .../RouteDefaultsTemplatingValidatorTest.php | 2 + .../RouteDefaultsTwigValidatorTest.php | 2 + .../RouteDefaultsValidatorTest.php | 12 +- 54 files changed, 491 insertions(+), 386 deletions(-) diff --git a/src/CmfRoutingBundle.php b/src/CmfRoutingBundle.php index 1a1f4d47..b3c87030 100644 --- a/src/CmfRoutingBundle.php +++ b/src/CmfRoutingBundle.php @@ -1,5 +1,7 @@ load('validators.xml'); } + /** + * Returns the base path for the XSD files. + * + * @return string The XSD base path + */ + public function getXsdValidationBasePath() + { + return __DIR__.'/../Resources/config/schema'; + } + + public function getNamespace() + { + return 'http://cmf.symfony.com/schema/dic/routing'; + } + private function setupChainRouter(array $config, ContainerBuilder $container, LoaderInterface $loader) { $loader->load('routing-chain.xml'); @@ -94,7 +111,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container, $container->setParameter('cmf_routing.default_controller', $defaultController); $locales = $config['locales']; - if (0 === count($locales) && $config['auto_locale_pattern']) { + if (0 === \count($locales) && $config['auto_locale_pattern']) { throw new InvalidConfigurationException('It makes no sense to activate auto_locale_pattern when no locales are configured.'); } @@ -148,17 +165,17 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container, $dynamic = $container->getDefinition('cmf_routing.dynamic_router'); // if any mappings are defined, set the respective route enhancer - if (count($config['controllers_by_type']) > 0) { + if (\count($config['controllers_by_type']) > 0) { $container->getDefinition('cmf_routing.enhancer.controllers_by_type') ->addTag('dynamic_router_route_enhancer', ['priority' => 60]); } - if (count($config['controllers_by_class']) > 0) { + if (\count($config['controllers_by_class']) > 0) { $container->getDefinition('cmf_routing.enhancer.controllers_by_class') ->addTag('dynamic_router_route_enhancer', ['priority' => 50]); } - if (count($config['templates_by_class']) > 0) { + if (\count($config['templates_by_class']) > 0) { $container->getDefinition('cmf_routing.enhancer.templates_by_class') ->addTag('dynamic_router_route_enhancer', ['priority' => 40]); @@ -197,7 +214,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container, ->addTag('dynamic_router_route_enhancer', ['priority' => -100]); } - if (count($config['route_filters_by_id']) > 0) { + if (\count($config['route_filters_by_id']) > 0) { $matcher = $container->getDefinition('cmf_routing.nested_matcher'); foreach ($config['route_filters_by_id'] as $id => $priority) { @@ -217,7 +234,7 @@ private function loadPhpcrProvider(array $config, LoaderInterface $loader, Conta $container->setParameter('cmf_routing.dynamic.persistence.phpcr.manager_name', $config['manager_name']); - if (0 === count($locales)) { + if (0 === \count($locales)) { $container->removeDefinition('cmf_routing.phpcrodm_route_locale_listener'); } elseif (!$matchImplicitLocale) { // remove all but the prefixes configuration from the service definition. @@ -272,19 +289,4 @@ private function configureParameters(ContainerBuilder $container, array $config, $container->setParameter('cmf_routing.'.$parameter, $config[$setting]); } } - - /** - * Returns the base path for the XSD files. - * - * @return string The XSD base path - */ - public function getXsdValidationBasePath() - { - return __DIR__.'/../Resources/config/schema'; - } - - public function getNamespace() - { - return 'http://cmf.symfony.com/schema/dic/routing'; - } } diff --git a/src/DependencyInjection/Compiler/SetRouterPass.php b/src/DependencyInjection/Compiler/SetRouterPass.php index 9a1ebb2c..4b8ad3c1 100644 --- a/src/DependencyInjection/Compiler/SetRouterPass.php +++ b/src/DependencyInjection/Compiler/SetRouterPass.php @@ -1,5 +1,7 @@ getRootNode(); } - $this->addChainSection($rootNode); $this->addDynamicSection($rootNode); @@ -100,7 +101,7 @@ private function addDynamicSection(ArrayNodeDefinition $root) ->addDefaultsIfNotSet() ->validate() ->ifTrue(function ($v) { - return count(array_filter($v, function ($persistence) { + return \count(array_filter($v, function ($persistence) { return $persistence['enabled']; })) > 1; }) diff --git a/src/Doctrine/DoctrineProvider.php b/src/Doctrine/DoctrineProvider.php index 2c76e5d3..0c23e836 100644 --- a/src/Doctrine/DoctrineProvider.php +++ b/src/Doctrine/DoctrineProvider.php @@ -1,5 +1,7 @@ getObjectManager()->getClassMetadata($class); $ids = $meta->getIdentifierValues($content); - if (1 !== count($ids)) { + if (1 !== \count($ids)) { throw new \Exception(sprintf('Class "%s" must use only one identifier', $class)); } @@ -72,4 +62,16 @@ public function getContentId($content) return; } } + + /** + * Determine target class and id for this content. + * + * @param mixed $identifier as produced by getContentId + * + * @return array with model first element, id second + */ + protected function getModelAndId($identifier) + { + return explode(':', $identifier, 2); + } } diff --git a/src/Doctrine/Orm/Route.php b/src/Doctrine/Orm/Route.php index fd92f187..4d866a65 100644 --- a/src/Doctrine/Orm/Route.php +++ b/src/Doctrine/Orm/Route.php @@ -1,5 +1,7 @@ candidatesStrategy->getCandidates($request); - if (0 === count($candidates)) { + if (0 === \count($candidates)) { return $collection; } $routes = $this->getRouteRepository()->findByStaticPrefix($candidates, ['position' => 'ASC']); diff --git a/src/Doctrine/Phpcr/ContentRepository.php b/src/Doctrine/Phpcr/ContentRepository.php index fe8815be..7bc1d78d 100644 --- a/src/Doctrine/Phpcr/ContentRepository.php +++ b/src/Doctrine/Phpcr/ContentRepository.php @@ -1,5 +1,7 @@ candidates = $candidates; } - /** - * @return array - */ - protected function getPrefixes() - { - return $this->candidates->getPrefixes(); - } - public function postLoad(LifecycleEventArgs $args) { $this->updateId($args); @@ -66,6 +60,14 @@ public function postMove(LifecycleEventArgs $args) $this->updateId($args); } + /** + * @return array + */ + protected function getPrefixes() + { + return $this->candidates->getPrefixes(); + } + protected function updateId(LifecycleEventArgs $args) { $doc = $args->getObject(); diff --git a/src/Doctrine/Phpcr/LocaleListener.php b/src/Doctrine/Phpcr/LocaleListener.php index 3b39010a..68d09ae7 100644 --- a/src/Doctrine/Phpcr/LocaleListener.php +++ b/src/Doctrine/Phpcr/LocaleListener.php @@ -1,5 +1,7 @@ locales)) { + if (\in_array($locale = $matches[2], $this->locales, true)) { if ($force || !$doc->getDefault('_locale')) { $doc->setDefault('_locale', $locale); } diff --git a/src/Doctrine/Phpcr/PrefixCandidates.php b/src/Doctrine/Phpcr/PrefixCandidates.php index 35cf4e29..03c4075f 100644 --- a/src/Doctrine/Phpcr/PrefixCandidates.php +++ b/src/Doctrine/Phpcr/PrefixCandidates.php @@ -1,5 +1,7 @@ getPrefixes(); - if (in_array('', $prefixes) || !count($prefixes)) { + if (\in_array('', $prefixes, true) || !\count($prefixes)) { return; } @@ -110,7 +112,7 @@ public function getCandidates(Request $request) $locale = $this->determineLocale($url); if ($locale) { - $url = substr($url, strlen($locale) + 1); + $url = substr($url, \strlen($locale) + 1); foreach ($this->getPrefixes() as $prefix) { $candidates = array_unique(array_merge($candidates, $this->getCandidatesFor($url, $prefix))); } diff --git a/src/Doctrine/Phpcr/PrefixInterface.php b/src/Doctrine/Phpcr/PrefixInterface.php index 9a6a01df..21982047 100644 --- a/src/Doctrine/Phpcr/PrefixInterface.php +++ b/src/Doctrine/Phpcr/PrefixInterface.php @@ -1,5 +1,7 @@ getOption('add_trailing_slash') && '/' !== $pattern[strlen($pattern) - 1]) { + if ($this->getOption('add_trailing_slash') && '/' !== $pattern[\strlen($pattern) - 1]) { $pattern .= '/'; } diff --git a/src/Doctrine/Phpcr/Route.php b/src/Doctrine/Phpcr/Route.php index e7613eea..f919a9c3 100644 --- a/src/Doctrine/Phpcr/Route.php +++ b/src/Doctrine/Phpcr/Route.php @@ -1,5 +1,7 @@ parent = $parent; @@ -159,8 +161,8 @@ public function getName() */ public function setPosition($parent, $name) { - if (!is_object($parent)) { - throw new InvalidArgumentException('Parent must be an object '.gettype($parent).' given.'); + if (!\is_object($parent)) { + throw new InvalidArgumentException('Parent must be an object '.\gettype($parent).' given.'); } $this->parent = $parent; @@ -225,9 +227,9 @@ public function getStaticPrefix() * @param string $id PHPCR id of this document * @param string $idPrefix part of the id that can be removed * - * @return string the static part of the pattern of this route - * * @throws \LogicException if there is no prefix or the prefix does not match + * + * @return string the static part of the pattern of this route */ public function generateStaticPrefix($id, $idPrefix) { @@ -239,7 +241,7 @@ public function generateStaticPrefix($id, $idPrefix) throw new \LogicException("The id prefix '$idPrefix' does not match the route document path '$id'"); } - $url = substr($id, strlen($idPrefix)); + $url = substr($id, \strlen($idPrefix)); if (!$url) { $url = '/'; } @@ -255,7 +257,7 @@ public function generateStaticPrefix($id, $idPrefix) public function getPath() { $pattern = parent::getPath(); - if ($this->getOption('add_trailing_slash') && '/' !== $pattern[strlen($pattern) - 1]) { + if ($this->getOption('add_trailing_slash') && '/' !== $pattern[\strlen($pattern) - 1]) { $pattern .= '/'; } diff --git a/src/Doctrine/Phpcr/RouteProvider.php b/src/Doctrine/Phpcr/RouteProvider.php index 21bd4b23..12de1238 100644 --- a/src/Doctrine/Phpcr/RouteProvider.php +++ b/src/Doctrine/Phpcr/RouteProvider.php @@ -1,5 +1,7 @@ routeCollectionLimit) { - return []; - } - - try { - /** @var $dm DocumentManager */ - $dm = $this->getObjectManager(); - } catch (RepositoryException $e) { - // special case: there is not even a database existing. this means there are no routes. - if ($e->getPrevious() instanceof TableNotFoundException) { - return []; - } - - throw $e; - } - $qb = $dm->createQueryBuilder(); - - $qb->from('d')->document(SymfonyRoute::class, 'd'); - - $this->candidatesStrategy->restrictQuery($qb); - - $query = $qb->getQuery(); - if ($this->routeCollectionLimit) { - $query->setMaxResults($this->routeCollectionLimit); - } - - return $query->getResult(); - } - /** * {@inheritdoc} */ @@ -223,4 +188,41 @@ public function getRoutesByNames($names = null) return $documents; } + + /** + * Get all the routes in the repository that are under one of the + * configured prefixes. This respects the limit. + * + * @return array + */ + private function getAllRoutes() + { + if (0 === $this->routeCollectionLimit) { + return []; + } + + try { + /** @var $dm DocumentManager */ + $dm = $this->getObjectManager(); + } catch (RepositoryException $e) { + // special case: there is not even a database existing. this means there are no routes. + if ($e->getPrevious() instanceof TableNotFoundException) { + return []; + } + + throw $e; + } + $qb = $dm->createQueryBuilder(); + + $qb->from('d')->document(SymfonyRoute::class, 'd'); + + $this->candidatesStrategy->restrictQuery($qb); + + $query = $qb->getQuery(); + if ($this->routeCollectionLimit) { + $query->setMaxResults($this->routeCollectionLimit); + } + + return $query->getResult(); + } } diff --git a/src/Doctrine/RouteConditionMetadataListener.php b/src/Doctrine/RouteConditionMetadataListener.php index 6321d6cb..941497a8 100644 --- a/src/Doctrine/RouteConditionMetadataListener.php +++ b/src/Doctrine/RouteConditionMetadataListener.php @@ -1,5 +1,7 @@ true, ]); } else { - throw new \LogicException(sprintf('Class metadata was neither PHPCR nor ORM but %s', get_class($meta))); + throw new \LogicException(sprintf('Class metadata was neither PHPCR nor ORM but %s', \get_class($meta))); } } } diff --git a/src/Form/Type/RouteTypeType.php b/src/Form/Type/RouteTypeType.php index 3c731fbe..f7fe8259 100644 --- a/src/Form/Type/RouteTypeType.php +++ b/src/Form/Type/RouteTypeType.php @@ -1,5 +1,7 @@ setVariablePattern(substr($pattern, strlen($this->getStaticPrefix()))); + return $this->setVariablePattern(substr($pattern, \strlen($this->getStaticPrefix()))); } /** @@ -284,4 +274,16 @@ public function compile() return parent::compile(); } + + /** + * Helper method to check if an option is a boolean option to allow better forms. + * + * @param string $name + * + * @return bool whether $name is a boolean option + */ + protected function isBooleanOption($name) + { + return \in_array($name, ['add_format_pattern', 'add_locale_pattern'], true); + } } diff --git a/src/Routing/DynamicRouter.php b/src/Routing/DynamicRouter.php index c948b467..2cb7fdeb 100644 --- a/src/Routing/DynamicRouter.php +++ b/src/Routing/DynamicRouter.php @@ -1,5 +1,7 @@ cleanDefaults($defaults, $request); } + /** + * Set the request stack so that we can find the current request. + * + * @param RequestStack $requestStack + */ + public function setRequestStack(RequestStack $requestStack) + { + $this->requestStack = $requestStack; + } + + /** + * Get the current request from the request stack. + * + * @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException + * + * @return Request + */ + public function getRequest() + { + $currentRequest = $this->requestStack->getCurrentRequest(); + if (!$currentRequest) { + throw new ResourceNotFoundException('There is no request in the request stack'); + } + + return $currentRequest; + } + /** * Clean up the match data and move some values into the request attributes. * @@ -109,31 +138,4 @@ protected function cleanDefaults($defaults, Request $request = null) return $defaults; } - - /** - * Set the request stack so that we can find the current request. - * - * @param RequestStack $requestStack - */ - public function setRequestStack(RequestStack $requestStack) - { - $this->requestStack = $requestStack; - } - - /** - * Get the current request from the request stack. - * - * @return Request - * - * @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function getRequest() - { - $currentRequest = $this->requestStack->getCurrentRequest(); - if (!$currentRequest) { - throw new ResourceNotFoundException('There is no request in the request stack'); - } - - return $currentRequest; - } } diff --git a/src/Validator/Constraints/RouteDefaults.php b/src/Validator/Constraints/RouteDefaults.php index 6d77ddc3..a38e8799 100644 --- a/src/Validator/Constraints/RouteDefaults.php +++ b/src/Validator/Constraints/RouteDefaults.php @@ -1,5 +1,7 @@ clearDb($singleModel); } diff --git a/tests/Functional/Doctrine/Orm/RouteProviderTest.php b/tests/Functional/Doctrine/Orm/RouteProviderTest.php index 7db7f3b4..e41eb587 100644 --- a/tests/Functional/Doctrine/Orm/RouteProviderTest.php +++ b/tests/Functional/Doctrine/Orm/RouteProviderTest.php @@ -1,5 +1,7 @@ getParameters(); $this->assertSame($route, $redirect->getRouteTarget()); $defaults = $redirect->getDefaults(); - $this->assertEquals(['test' => 'toast'], $defaults); + $this->assertSame(['test' => 'toast'], $defaults); } public function testSetContent() diff --git a/tests/Functional/Doctrine/Phpcr/RouteProviderTest.php b/tests/Functional/Doctrine/Phpcr/RouteProviderTest.php index 3560b180..f500c4f5 100644 --- a/tests/Functional/Doctrine/Phpcr/RouteProviderTest.php +++ b/tests/Functional/Doctrine/Phpcr/RouteProviderTest.php @@ -1,5 +1,7 @@ repository = $this->getContainer()->get('cmf_routing.route_provider'); } - private function buildRoutes() - { - $root = $this->getDm()->find(null, self::ROUTE_ROOT); - - $route = new Route(); - $route->setPosition($root, 'testroute'); - $route->setDefault('_format', 'html'); - $this->getDm()->persist($route); - - // smuggle a non-route thing into the repository - $noroute = new Generic(); - $noroute->setParentDocument($route); - $noroute->setNodename('noroute'); - $this->getDm()->persist($noroute); - - $childroute = new Route(); - $childroute->setPosition($noroute, 'child'); - $childroute->setDefault('_format', 'json'); - $this->getDm()->persist($childroute); - - $this->getDm()->flush(); - $this->getDm()->clear(); - } - public function testGetRouteCollectionForRequest() { $this->buildRoutes(); @@ -69,17 +47,17 @@ public function testGetRouteCollectionForRequest() $iterator = $routes->getIterator(); $this->assertTrue($iterator->valid()); - $this->assertEquals(self::ROUTE_ROOT.'/testroute/noroute/child', $iterator->key()); - $this->assertEquals('json', $iterator->current()->getDefault('_format')); + $this->assertSame(self::ROUTE_ROOT.'/testroute/noroute/child', $iterator->key()); + $this->assertSame('json', $iterator->current()->getDefault('_format')); $iterator->next(); $this->assertTrue($iterator->valid()); - $this->assertEquals(self::ROUTE_ROOT.'/testroute', $iterator->key()); - $this->assertEquals('html', $iterator->current()->getDefault('_format')); + $this->assertSame(self::ROUTE_ROOT.'/testroute', $iterator->key()); + $this->assertSame('html', $iterator->current()->getDefault('_format')); $iterator->next(); $this->assertTrue($iterator->valid()); - $this->assertEquals(self::ROUTE_ROOT, $iterator->key()); + $this->assertSame(self::ROUTE_ROOT, $iterator->key()); $this->assertNull($iterator->current()->getDefault('_format')); } @@ -94,17 +72,17 @@ public function testGetRouteCollectionForRequestFormat() $iterator = $routes->getIterator(); $this->assertTrue($iterator->valid()); - $this->assertEquals(self::ROUTE_ROOT.'/testroute/noroute/child', $iterator->key()); - $this->assertEquals('json', $iterator->current()->getDefault('_format')); + $this->assertSame(self::ROUTE_ROOT.'/testroute/noroute/child', $iterator->key()); + $this->assertSame('json', $iterator->current()->getDefault('_format')); $iterator->next(); $this->assertTrue($iterator->valid()); - $this->assertEquals(self::ROUTE_ROOT.'/testroute', $iterator->key()); - $this->assertEquals('html', $iterator->current()->getDefault('_format')); + $this->assertSame(self::ROUTE_ROOT.'/testroute', $iterator->key()); + $this->assertSame('html', $iterator->current()->getDefault('_format')); $iterator->next(); $this->assertTrue($iterator->valid()); - $this->assertEquals(self::ROUTE_ROOT, $iterator->key()); + $this->assertSame(self::ROUTE_ROOT, $iterator->key()); $this->assertNull($iterator->current()->getDefault('_format')); } @@ -120,7 +98,7 @@ public function testGetRouteCollectionForRequestNonPhpcrUrl() $iterator = $routes->getIterator(); $this->assertTrue($iterator->valid()); - $this->assertEquals(self::ROUTE_ROOT, $iterator->key()); + $this->assertSame(self::ROUTE_ROOT, $iterator->key()); } /** @@ -148,4 +126,28 @@ public function testGetRoutesByNames() $this->assertCount(2, $routes); $this->assertContainsOnlyInstancesOf(RouteObjectInterface::class, $routes); } + + private function buildRoutes() + { + $root = $this->getDm()->find(null, self::ROUTE_ROOT); + + $route = new Route(); + $route->setPosition($root, 'testroute'); + $route->setDefault('_format', 'html'); + $this->getDm()->persist($route); + + // smuggle a non-route thing into the repository + $noroute = new Generic(); + $noroute->setParentDocument($route); + $noroute->setNodename('noroute'); + $this->getDm()->persist($noroute); + + $childroute = new Route(); + $childroute->setPosition($noroute, 'child'); + $childroute->setDefault('_format', 'json'); + $this->getDm()->persist($childroute); + + $this->getDm()->flush(); + $this->getDm()->clear(); + } } diff --git a/tests/Functional/Doctrine/Phpcr/RouteTest.php b/tests/Functional/Doctrine/Phpcr/RouteTest.php index 094f64e5..81246469 100644 --- a/tests/Functional/Doctrine/Phpcr/RouteTest.php +++ b/tests/Functional/Doctrine/Phpcr/RouteTest.php @@ -1,5 +1,7 @@ getDm()->persist($route); $this->getDm()->flush(); - $this->assertEquals('/testroute', $route->getPath()); + $this->assertSame('/testroute', $route->getPath()); $this->getDm()->clear(); $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/testroute'); $this->assertNotNull($route->getContent()); - $this->assertEquals('/testroute', $route->getPath()); + $this->assertSame('/testroute', $route->getPath()); - $this->assertEquals('y', $route->getDefault('x')); + $this->assertSame('y', $route->getDefault('x')); $defaults = $route->getDefaults(); $this->assertArrayHasKey('x', $defaults); - $this->assertEquals('y', $defaults['x']); + $this->assertSame('y', $defaults['x']); $requirements = $route->getRequirements(); $this->assertArrayHasKey('testreq', $requirements); - $this->assertEquals('testregex', $requirements['testreq']); + $this->assertSame('testregex', $requirements['testreq']); $options = $route->getOptions(); $this->assertArrayHasKey('test', $options); - $this->assertEquals('value', $options['test']); + $this->assertSame('value', $options['test']); $this->assertArrayHasKey('another', $options); - $this->assertEquals('value2', $options['another']); + $this->assertSame('value2', $options['another']); } public function testPersistEmptyOptions() @@ -84,7 +86,7 @@ public function testPersistEmptyOptions() $this->assertCount(0, $requirements); $options = $route->getOptions(); - $this->assertTrue(1 >= count($options)); // there is a default option for the compiler + $this->assertTrue(1 >= \count($options)); // there is a default option for the compiler return $route; } @@ -103,29 +105,29 @@ public function testConditionOption() $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/conditionroute'); - $this->assertEquals('foobar', $route->getCondition()); + $this->assertSame('foobar', $route->getCondition()); } public function testRootRoute() { $root = $this->getDm()->find(null, self::ROUTE_ROOT); - $this->assertEquals('/', $root->getPath()); + $this->assertSame('/', $root->getPath()); } public function testSetPath() { $root = $this->getDm()->find(null, self::ROUTE_ROOT); - $this->assertEquals('/', $root->getStaticPrefix()); + $this->assertSame('/', $root->getStaticPrefix()); $root->setPath('/{test}'); - $this->assertEquals('{test}', $root->getVariablePattern()); + $this->assertSame('{test}', $root->getVariablePattern()); } public function testSetPattern() { $root = $this->getDm()->find(null, self::ROUTE_ROOT); $root->setVariablePattern('{test}'); - $this->assertEquals('/{test}', $root->getPath()); - $this->assertEquals('{test}', $root->getVariablePattern()); + $this->assertSame('/{test}', $root->getPath()); + $this->assertSame('{test}', $root->getVariablePattern()); } /** @@ -142,7 +144,7 @@ public function testInvalidIdPrefix() $root = $this->getDm()->find(null, self::ROUTE_ROOT); $root->setPrefix('/changed'); // simulate a problem with the prefix setter listener $this->expectException(\LogicException::class); - $this->assertEquals('/', $root->getPath()); + $this->assertSame('/', $root->getPath()); } public function testPrefixNonpersisted() @@ -166,6 +168,6 @@ public function testDefaultFormat() $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/format'); - $this->assertEquals('/format.{_format}', $route->getPath()); + $this->assertSame('/format.{_format}', $route->getPath()); } } diff --git a/tests/Functional/Routing/DynamicRouterTest.php b/tests/Functional/Routing/DynamicRouterTest.php index c6ce2b31..dad4604c 100644 --- a/tests/Functional/Routing/DynamicRouterTest.php +++ b/tests/Functional/Routing/DynamicRouterTest.php @@ -1,5 +1,7 @@ assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); - $this->assertEquals($expected, array_keys($matches)); - $this->assertEquals('/test/routing/testroute/child', $matches[RouteObjectInterface::ROUTE_NAME]); + $this->assertSame($expected, array_keys($matches)); + $this->assertSame('/test/routing/testroute/child', $matches[RouteObjectInterface::ROUTE_NAME]); } public function testMatchParameters() @@ -122,7 +123,7 @@ public function testMatchParameters() $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); ksort($matches); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); } public function testNoMatch() @@ -160,7 +161,7 @@ public function testMatchDefaultFormat() ksort($matches); $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); } public function testMatchFormat() @@ -176,7 +177,7 @@ public function testMatchFormat() ksort($matches); $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); $expected = [ '_controller' => 'testController', @@ -188,7 +189,7 @@ public function testMatchFormat() ksort($matches); $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); $expected = [ '_controller' => 'testJsonController', @@ -200,7 +201,7 @@ public function testMatchFormat() ksort($matches); $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); } public function testNoMatchingFormat() @@ -230,7 +231,7 @@ public function testMatchLocale() '_locale' => 'de', '_route' => self::ROUTE_ROOT.'/de', ]; - $this->assertEquals( + $this->assertSame( $expected, $this->router->match('/de') ); @@ -239,7 +240,7 @@ public function testMatchLocale() '_locale' => 'de', '_route' => self::ROUTE_ROOT.'/de/testroute', ]; - $this->assertEquals( + $this->assertSame( $expected, $this->router->match('/de/testroute') ); @@ -248,7 +249,7 @@ public function testMatchLocale() '_controller' => 'testController', '_route' => self::ROUTE_ROOT.'/es', ]; - $this->assertEquals( + $this->assertSame( $expected, $this->router->match('/es') ); @@ -275,7 +276,7 @@ public function testEnhanceControllerByAlias() ksort($matches); $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); } public function testEnhanceControllerByClass() @@ -298,7 +299,7 @@ public function testEnhanceControllerByClass() ksort($matches); $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); } public function testEnhanceTemplateByClass() @@ -329,10 +330,10 @@ public function testEnhanceTemplateByClass() $matches = $this->router->matchRequest($request); ksort($matches); - $this->assertEquals($expected, $matches); + $this->assertSame($expected, $matches); $this->assertTrue($request->attributes->has(DynamicRouter::ROUTE_KEY)); $this->assertTrue($request->attributes->has(DynamicRouter::CONTENT_TEMPLATE)); - $this->assertEquals('TestBundle:Content:index.html.twig', $request->attributes->get(DynamicRouter::CONTENT_TEMPLATE)); + $this->assertSame('TestBundle:Content:index.html.twig', $request->attributes->get(DynamicRouter::CONTENT_TEMPLATE)); } public function testGenerate() @@ -340,14 +341,14 @@ public function testGenerate() $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/testroute/child'); $url = $this->router->generate($route, ['test' => 'value']); - $this->assertEquals('/testroute/child?test=value', $url); + $this->assertSame('/testroute/child?test=value', $url); } public function testGenerateAbsolute() { $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/testroute/child'); $url = $this->router->generate($route, ['test' => 'value'], UrlGeneratorInterface::ABSOLUTE_URL); - $this->assertEquals('http://localhost/testroute/child?test=value', $url); + $this->assertSame('http://localhost/testroute/child?test=value', $url); } public function testGenerateParameters() @@ -355,7 +356,7 @@ public function testGenerateParameters() $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/testroute'); $url = $this->router->generate($route, ['slug' => 'gen-slug', 'test' => 'value']); - $this->assertEquals('/testroute/gen-slug?test=value', $url); + $this->assertSame('/testroute/gen-slug?test=value', $url); } public function testGenerateParametersInvalid() @@ -371,7 +372,7 @@ public function testGenerateDefaultFormat() $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/format'); $url = $this->router->generate($route, ['id' => 37]); - $this->assertEquals('/format/37', $url); + $this->assertSame('/format/37', $url); } public function testGenerateFormat() @@ -379,7 +380,7 @@ public function testGenerateFormat() $route = $this->getDm()->find(null, self::ROUTE_ROOT.'/format'); $url = $this->router->generate($route, ['id' => 37, '_format' => 'json']); - $this->assertEquals('/format/37.json', $url); + $this->assertSame('/format/37.json', $url); } public function testGenerateNoMatchingFormat() diff --git a/tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php b/tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php index 640b8048..d8fe662e 100644 --- a/tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php +++ b/tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php @@ -1,5 +1,7 @@ load([ @@ -335,4 +330,11 @@ public function testSettingCustomRouteClassForOrm() $this->assertContainerBuilderHasParameter('cmf_routing.backend_type_orm_custom', true); } + + protected function getContainerExtensions() + { + return [ + new CmfRoutingExtension(), + ]; + } } diff --git a/tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php b/tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php index ec13fddb..33b99f53 100644 --- a/tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php +++ b/tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php @@ -1,5 +1,7 @@ addCompilerPass(new SetRouterPass()); - } - public function testMapperPassReplacesRouterAlias() { $this->container->setParameter('cmf_routing.replace_symfony_router', true); @@ -39,4 +36,9 @@ public function testMapperPassDoesNotReplaceRouterAlias() $this->assertFalse($this->container->hasAlias('router')); } + + protected function registerCompilerPass(ContainerBuilder $container) + { + $container->addCompilerPass(new SetRouterPass()); + } } diff --git a/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php b/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php index 104576a7..633f195b 100644 --- a/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php +++ b/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php @@ -1,5 +1,7 @@ registerValidatorService(); } - protected function registerCompilerPass(ContainerBuilder $container) - { - $container->addCompilerPass(new TemplatingValidatorPass()); - } - /** * It should replace the validator class with the templating one and * provide the _templating_ service as second argument. @@ -43,8 +40,8 @@ public function testReplacesValidator() $definition = $this->container->getDefinition('cmf_routing.validator.route_defaults'); - $this->assertEquals(RouteDefaultsTemplatingValidator::class, $definition->getClass()); - $this->assertEquals(['foo', new Reference('templating')], $definition->getArguments()); + $this->assertSame(RouteDefaultsTemplatingValidator::class, $definition->getClass()); + $this->assertSame(['foo', new Reference('templating')], $definition->getArguments()); } /** @@ -57,8 +54,13 @@ public function testDoesNotReplaceValidator() $definition = $this->container->getDefinition('cmf_routing.validator.route_defaults'); - $this->assertEquals(\stdClass::class, $definition->getClass()); - $this->assertEquals(['foo', 'bar'], $definition->getArguments()); + $this->assertSame(\stdClass::class, $definition->getClass()); + $this->assertSame(['foo', 'bar'], $definition->getArguments()); + } + + protected function registerCompilerPass(ContainerBuilder $container) + { + $container->addCompilerPass(new TemplatingValidatorPass()); } private function registerValidatorService() diff --git a/tests/Unit/DependencyInjection/Compiler/ValidationPassTest.php b/tests/Unit/DependencyInjection/Compiler/ValidationPassTest.php index f31f50c1..1bae30f9 100644 --- a/tests/Unit/DependencyInjection/Compiler/ValidationPassTest.php +++ b/tests/Unit/DependencyInjection/Compiler/ValidationPassTest.php @@ -1,5 +1,7 @@ addCompilerPass(new ValidationPass()); - } - /** * It should register the PHPCR documents for validation only when: * - the PHP backend is enabled AND @@ -80,4 +77,9 @@ public function provideDocumentsValidationContext() [false, false, false], ]; } + + protected function registerCompilerPass(ContainerBuilder $container) + { + $container->addCompilerPass(new ValidationPass()); + } } diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index 3f54cdcf..d5109098 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -1,5 +1,7 @@ assertProcessedConfigurationEquals($expectedConfiguration, [$format]); } } + + protected function getContainerExtension() + { + return new CmfRoutingExtension(); + } + + protected function getConfiguration() + { + return new Configuration(); + } } diff --git a/tests/Unit/DependencyInjection/XmlSchemaTest.php b/tests/Unit/DependencyInjection/XmlSchemaTest.php index 0ae79fc8..004f2ced 100644 --- a/tests/Unit/DependencyInjection/XmlSchemaTest.php +++ b/tests/Unit/DependencyInjection/XmlSchemaTest.php @@ -1,5 +1,7 @@ managerRegistry); $contentRepository->setManagerName('default'); - $this->assertEquals('id-123', $contentRepository->getContentId($this->document)); + $this->assertSame('id-123', $contentRepository->getContentId($this->document)); } public function testGetContentIdNoObject() diff --git a/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php b/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php index 6064d91f..dbfc5f94 100644 --- a/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php +++ b/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php @@ -1,5 +1,7 @@ listener->postLoad($args); - $this->assertEquals($originalArgs, $args); - } - - private function prepareMatch() - { - $this->routeMock - ->expects($this->once()) - ->method('getId') - ->will($this->returnValue('/cms/routes')) - ; - $this->routeMock - ->expects($this->once()) - ->method('setPrefix') - ->with('/cms/routes') - ; - - return new LifecycleEventArgs($this->routeMock, $this->dmMock); + $this->assertSame($originalArgs, $args); } public function testPostLoad() @@ -129,4 +115,20 @@ public function testOutside() $this->listener->postLoad($args); } + + private function prepareMatch() + { + $this->routeMock + ->expects($this->once()) + ->method('getId') + ->will($this->returnValue('/cms/routes')) + ; + $this->routeMock + ->expects($this->once()) + ->method('setPrefix') + ->with('/cms/routes') + ; + + return new LifecycleEventArgs($this->routeMock, $this->dmMock); + } } diff --git a/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php b/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php index 84893b36..06476ea3 100644 --- a/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php +++ b/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php @@ -1,5 +1,7 @@ listener->postLoad($args); $this->listener->postPersist($args); - $this->assertEquals($originalArgs, $args); + $this->assertSame($originalArgs, $args); } public function testNoPrefixMatch() @@ -81,25 +83,6 @@ public function testNoPrefixMatch() $this->listener->postLoad($args); } - private function prepareMatch() - { - $this->routeMock->expects($this->once()) - ->method('getId') - ->will($this->returnValue('/cms/routes/de/my/route')) - ; - - $this->routeMock->expects($this->once()) - ->method('setDefault') - ->with('_locale', 'de') - ; - $this->routeMock->expects($this->once()) - ->method('setRequirement') - ->with('_locale', 'de') - ; - - return new LifecycleEventArgs($this->routeMock, $this->dmMock); - } - public function testLoad() { $this->listener->postLoad($this->prepareMatch()); @@ -141,7 +124,7 @@ public function testMoveNoRoute() $originalArgs = clone $moveArgs; $this->listener->postMove($moveArgs); - $this->assertEquals($originalArgs, $moveArgs); + $this->assertSame($originalArgs, $moveArgs); } public function testMoved() @@ -168,7 +151,7 @@ public function testMoved() public function testSetLocales() { $this->listener->setLocales(['xx']); - $this->assertAttributeEquals(['xx'], 'locales', $this->listener); + $this->assertAttributeSame(['xx'], 'locales', $this->listener); } public function testHaslocale() @@ -273,4 +256,23 @@ public function testAvailableTranslations() $args = new LifecycleEventArgs($this->routeMock, $this->dmMock); $this->listener->postLoad($args); } + + private function prepareMatch() + { + $this->routeMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue('/cms/routes/de/my/route')) + ; + + $this->routeMock->expects($this->once()) + ->method('setDefault') + ->with('_locale', 'de') + ; + $this->routeMock->expects($this->once()) + ->method('setRequirement') + ->with('_locale', 'de') + ; + + return new LifecycleEventArgs($this->routeMock, $this->dmMock); + } } diff --git a/tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php b/tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php index 45f33eca..de92b971 100644 --- a/tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php +++ b/tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php @@ -1,5 +1,7 @@ assertEquals(['/routes'], $candidates->getPrefixes()); + $this->assertSame(['/routes'], $candidates->getPrefixes()); $candidates->addPrefix('/simple'); - $this->assertEquals(['/routes', '/simple'], $candidates->getPrefixes()); + $this->assertSame(['/routes', '/simple'], $candidates->getPrefixes()); $candidates->setPrefixes(['/other']); - $this->assertEquals(['/other'], $candidates->getPrefixes()); + $this->assertSame(['/other'], $candidates->getPrefixes()); } public function testGetCandidates() @@ -39,7 +41,7 @@ public function testGetCandidates() $candidates = new PrefixCandidates(['/routes', '/simple']); $paths = $candidates->getCandidates($request); - $this->assertEquals( + $this->assertSame( [ '/routes/my/path.html', '/routes/my/path', @@ -61,7 +63,7 @@ public function testGetCandidatesPercentEncoded() $candidates = new PrefixCandidates(['/routes', '/simple']); $paths = $candidates->getCandidates($request); - $this->assertEquals( + $this->assertSame( [ '/routes/my/path percent encoded.html', '/routes/my/path percent encoded', @@ -83,7 +85,7 @@ public function testGetCandidatesLocales() $candidates = new PrefixCandidates(['/routes', '/simple'], ['de', 'fr']); $paths = $candidates->getCandidates($request); - $this->assertEquals( + $this->assertSame( [ '/routes/de/path.html', '/routes/de/path', diff --git a/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php b/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php index 62417390..d69b2114 100644 --- a/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php +++ b/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php @@ -1,5 +1,7 @@ getRouteByName('/cms/routes/test-route'); $this->assertInstanceOf(Route::class, $foundRoute); - $this->assertEquals('/cms/routes/test-route', $foundRoute->getPath()); + $this->assertSame('/cms/routes/test-route', $foundRoute->getPath()); } public function testGetRouteByNameUuid() @@ -196,7 +197,7 @@ public function testGetRouteByNameUuid() $foundRoute = $routeProvider->getRouteByName($uuid); $this->assertInstanceOf(Route::class, $foundRoute); - $this->assertEquals('/cms/routes/test-route', $foundRoute->getPath()); + $this->assertSame('/cms/routes/test-route', $foundRoute->getPath()); } public function testGetRouteByNameUuidNotFound() @@ -480,59 +481,6 @@ public function testGetRoutesByNamesUuid() $this->assertCount(1, $routes); } - private function doRouteDump($limit) - { - $from = $this->createMock(SourceFactory::class); - $from->expects($this->once()) - ->method('document') - ->with(Route::class, 'd') - ; - - $query = $this->createMock(Query::class); - $query->expects($this->once())->method('getResult'); - if ($limit) { - $query - ->expects($this->once()) - ->method('setMaxResults') - ->with($limit) - ; - } else { - $query - ->expects($this->never()) - ->method('setMaxResults') - ; - } - - $queryBuilder = $this->createMock(QueryBuilder::class); - $queryBuilder->expects($this->once()) - ->method('from') - ->with('d') - ->will($this->returnValue($from)) - ; - $queryBuilder->expects($this->once()) - ->method('getQuery') - ->will($this->returnValue($query)) - ; - - $this->dmMock - ->expects($this->once()) - ->method('createQueryBuilder') - ->will($this->returnValue($queryBuilder)) - ; - - $this->candidatesMock - ->expects($this->once()) - ->method('restrictQuery') - ->with($queryBuilder) - ; - - $routeProvider = new RouteProvider($this->managerRegistryMock, $this->candidatesMock); - $routeProvider->setManagerName('default'); - $routeProvider->setRouteCollectionLimit($limit); - - $routeProvider->getRoutesByNames(); - } - public function testDumpRoutesNoLimit() { $this->doRouteDump(null); @@ -557,7 +505,7 @@ public function testDumpRoutesDisabled() $routeProvider->setManagerName('default'); $routeProvider->setRouteCollectionLimit(0); - $this->assertEquals([], $routeProvider->getRoutesByNames()); + $this->assertSame([], $routeProvider->getRoutesByNames()); } /** @@ -618,11 +566,64 @@ function ($name) use ($objectManagers) { $foundRoute = $routeProvider->getRouteByName('/cms/routes/test-route'); $this->assertInstanceOf(Route::class, $foundRoute); - $this->assertEquals('/cms/routes/test-route', $foundRoute->getPath()); + $this->assertSame('/cms/routes/test-route', $foundRoute->getPath()); $routeProvider->setManagerName('new_manager'); $newFoundRoute = $routeProvider->getRouteByName('/cms/routes/test-route'); $this->assertInstanceOf(Route::class, $newFoundRoute); - $this->assertEquals('/cms/routes/new-route', $newFoundRoute->getPath()); + $this->assertSame('/cms/routes/new-route', $newFoundRoute->getPath()); + } + + private function doRouteDump($limit) + { + $from = $this->createMock(SourceFactory::class); + $from->expects($this->once()) + ->method('document') + ->with(Route::class, 'd') + ; + + $query = $this->createMock(Query::class); + $query->expects($this->once())->method('getResult'); + if ($limit) { + $query + ->expects($this->once()) + ->method('setMaxResults') + ->with($limit) + ; + } else { + $query + ->expects($this->never()) + ->method('setMaxResults') + ; + } + + $queryBuilder = $this->createMock(QueryBuilder::class); + $queryBuilder->expects($this->once()) + ->method('from') + ->with('d') + ->will($this->returnValue($from)) + ; + $queryBuilder->expects($this->once()) + ->method('getQuery') + ->will($this->returnValue($query)) + ; + + $this->dmMock + ->expects($this->once()) + ->method('createQueryBuilder') + ->will($this->returnValue($queryBuilder)) + ; + + $this->candidatesMock + ->expects($this->once()) + ->method('restrictQuery') + ->with($queryBuilder) + ; + + $routeProvider = new RouteProvider($this->managerRegistryMock, $this->candidatesMock); + $routeProvider->setManagerName('default'); + $routeProvider->setRouteCollectionLimit($limit); + + $routeProvider->getRoutesByNames(); } } diff --git a/tests/Unit/Doctrine/Phpcr/RouteTest.php b/tests/Unit/Doctrine/Phpcr/RouteTest.php index cd1b5f70..fd21e4b1 100644 --- a/tests/Unit/Doctrine/Phpcr/RouteTest.php +++ b/tests/Unit/Doctrine/Phpcr/RouteTest.php @@ -1,5 +1,7 @@ route->getRouteChildren(); $this->assertCount(1, $res); - $this->assertEquals('child route1', $res[0]->getName()); + $this->assertSame('child route1', $res[0]->getName()); } public function testGetRouteChildrenNull() { $res = $this->route->getRouteChildren(); - $this->assertEquals([], $res); + $this->assertSame([], $res); } } diff --git a/tests/Unit/Form/Type/RouteTypeTypeTest.php b/tests/Unit/Form/Type/RouteTypeTypeTest.php index 977cfdca..999b7e36 100644 --- a/tests/Unit/Form/Type/RouteTypeTypeTest.php +++ b/tests/Unit/Form/Type/RouteTypeTypeTest.php @@ -1,5 +1,7 @@ router->setRequestStack($this->requestStack); } - private function assertRequestAttributes($request) - { - $this->assertTrue($request->attributes->has(DynamicRouter::CONTENT_KEY)); - $this->assertEquals('bla', $request->attributes->get(DynamicRouter::CONTENT_KEY)); - $this->assertTrue($request->attributes->has(DynamicRouter::CONTENT_TEMPLATE)); - $this->assertEquals('template', $request->attributes->get(DynamicRouter::CONTENT_TEMPLATE)); - } - /** * @group legacy */ @@ -101,7 +95,7 @@ public function testMatch() ; $parameters = $this->router->match('/foo'); - $this->assertEquals(['foo' => 'bar'], $parameters); + $this->assertSame(['foo' => 'bar'], $parameters); $this->assertRequestAttributes($this->request); } @@ -114,7 +108,7 @@ public function testMatchRequest() ; $parameters = $this->router->matchRequest($this->request); - $this->assertEquals(['foo' => 'bar'], $parameters); + $this->assertSame(['foo' => 'bar'], $parameters); $this->assertRequestAttributes($this->request); } @@ -141,8 +135,16 @@ public function testEventOptional() $router = new DynamicRouter($this->context, $this->matcher, $this->generator); $parameters = $router->matchRequest($this->request); - $this->assertEquals(['foo' => 'bar'], $parameters); + $this->assertSame(['foo' => 'bar'], $parameters); $this->assertRequestAttributes($this->request); } + + private function assertRequestAttributes($request) + { + $this->assertTrue($request->attributes->has(DynamicRouter::CONTENT_KEY)); + $this->assertSame('bla', $request->attributes->get(DynamicRouter::CONTENT_KEY)); + $this->assertTrue($request->attributes->has(DynamicRouter::CONTENT_TEMPLATE)); + $this->assertSame('template', $request->attributes->get(DynamicRouter::CONTENT_TEMPLATE)); + } } diff --git a/tests/Unit/Validator/Constraints/RouteDefaultsTemplatingValidatorTest.php b/tests/Unit/Validator/Constraints/RouteDefaultsTemplatingValidatorTest.php index 19b0a5d3..5ff14685 100644 --- a/tests/Unit/Validator/Constraints/RouteDefaultsTemplatingValidatorTest.php +++ b/tests/Unit/Validator/Constraints/RouteDefaultsTemplatingValidatorTest.php @@ -1,5 +1,7 @@ validator->validate(['_controller' => 'FrameworkBundle:Redirect:redirect'], new RouteDefaults()); @@ -106,4 +103,9 @@ public function testTemplateViolation() ->setParameter('%name%', 'NotExistingBundle:Foo:bar.html.twig') ->assertRaised(); } + + /** + * @return MockObject|EngineInterface|LoaderInterface + */ + abstract protected function mockEngine(); } From 0c86e7b4c00bff785467f734e99121780f2c3ca3 Mon Sep 17 00:00:00 2001 From: Maximilian Berghoff Date: Sat, 9 Feb 2019 04:57:46 +0100 Subject: [PATCH 47/68] Apply fixes from StyleCI (#435) [ci skip] [skip ci] --- tests/Functional/Routing/DynamicRouterTest.php | 1 + tests/Unit/Doctrine/Phpcr/RouteProviderTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/Functional/Routing/DynamicRouterTest.php b/tests/Functional/Routing/DynamicRouterTest.php index dad4604c..83fdfd4b 100644 --- a/tests/Functional/Routing/DynamicRouterTest.php +++ b/tests/Functional/Routing/DynamicRouterTest.php @@ -35,6 +35,7 @@ class DynamicRouterTest extends BaseTestCase { public const ROUTE_ROOT = '/test/routing'; + /** * @var ChainRouter */ diff --git a/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php b/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php index d69b2114..a5aa66b7 100644 --- a/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php +++ b/tests/Unit/Doctrine/Phpcr/RouteProviderTest.php @@ -56,6 +56,7 @@ class RouteProviderTest extends TestCase * @var Route|MockObject */ protected $route2Mock; + /** * @var ManagerRegistry|MockObject */ From de293eca0e0dbe0f3f6687732b8e842ce59e0319 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 10 Feb 2019 02:10:15 +0100 Subject: [PATCH 48/68] put some folders into phpunit configuration. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 8099ab47..7a1f4370 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ phpunit.xml composer.lock vendor tests/Fixtures/App/var/ +.phpunit/ +build/ +.roles/ From 7f60638bd71fc23fe754068452b83b2e7421b5e3 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 10 Feb 2019 02:15:30 +0100 Subject: [PATCH 49/68] equal instead of same --- .php_cs.dist | 1 - tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 9ccddb21..5759af56 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -45,7 +45,6 @@ $rules = [ 'void_return' => null, 'strict_comparison' => true, 'strict_param' => true, - 'php_unit_strict' => true, ]; diff --git a/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php b/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php index 06476ea3..60692fea 100644 --- a/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php +++ b/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php @@ -124,7 +124,7 @@ public function testMoveNoRoute() $originalArgs = clone $moveArgs; $this->listener->postMove($moveArgs); - $this->assertSame($originalArgs, $moveArgs); + $this->assertEquals($originalArgs, $moveArgs); } public function testMoved() From bb2d2ca6adae76869073e0fda038c0f581e6eefb Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 10 Feb 2019 22:00:27 +0100 Subject: [PATCH 50/68] Remove .php-dest from git --- .gitignore | 1 + .php_cs | 3 --- .php_cs.dist | 1 + php_cs.dist | 67 ---------------------------------------------------- 4 files changed, 2 insertions(+), 70 deletions(-) delete mode 100644 .php_cs delete mode 100644 php_cs.dist diff --git a/.gitignore b/.gitignore index 7a1f4370..17e383e5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ tests/Fixtures/App/var/ .phpunit/ build/ .roles/ +/.php_cs diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 97adafa4..00000000 --- a/.php_cs +++ /dev/null @@ -1,3 +0,0 @@ - null, 'strict_comparison' => true, 'strict_param' => true, + 'php_unit_strict' => true, ]; diff --git a/php_cs.dist b/php_cs.dist deleted file mode 100644 index bc0747fd..00000000 --- a/php_cs.dist +++ /dev/null @@ -1,67 +0,0 @@ - true, - '@Symfony:risky' => true, - 'array_syntax' => [ - 'syntax' => 'short', - ], - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'header_comment' => [ - 'header' => $header, - ], - 'no_extra_blank_lines' => true, - 'no_php4_constructor' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'ordered_class_elements' => true, - 'ordered_imports' => true, - 'phpdoc_order' => true, - '@PHP56Migration' => true, - '@PHP56Migration:risky' => true, - '@PHPUnit57Migration:risky' => true, - '@PHP70Migration' => true, - '@PHP70Migration:risky' => true, - '@PHPUnit60Migration:risky' => true, - '@PHP71Migration' => true, - '@PHP71Migration:risky' => true, - 'compact_nullable_typehint' => true, - 'void_return' => null, - 'strict_comparison' => true, - 'strict_param' => true, - 'php_unit_strict' => true, -]; - - -$finder = PhpCsFixer\Finder::create() - ->in(__DIR__) - ->exclude('Tests/Fixtures') - ->exclude('tests/Fixtures') - ->exclude('Resources/skeleton') - ->exclude('Resources/public/vendor') -; - -return PhpCsFixer\Config::create() - ->setFinder($finder) - ->setRiskyAllowed(true) - ->setRules($rules) - ->setUsingCache(true) -; From 40fa2ac9f70c4eaf369ab43111bb1305f4db9744 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 10 Feb 2019 22:04:36 +0100 Subject: [PATCH 51/68] use more common vesions --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index eb202ad2..3e0c7b5c 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "^7.1", "symfony-cmf/routing": "^2.1.0", - "symfony/framework-bundle": "^3.4 || ^4.0", + "symfony/framework-bundle": "^^3.4 || ^4.1", "twig/twig": "^1.35 || ^2.4.4" }, "require-dev": { @@ -28,7 +28,7 @@ "doctrine/orm": "^2.5", "symfony-cmf/testing": "^2.1.11", "doctrine/data-fixtures": "^1.0.0", - "symfony/validator": "^3.4 || ^4.0" + "symfony/validator": "^3.4 || ^4.1" }, "suggest": { "doctrine/phpcr-odm": "To enable support for the PHPCR ODM documents (^1.4)", From f961ab5ac367217bce6e838f3c4ffcdba18f36fd Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Mon, 11 Feb 2019 00:27:48 +0100 Subject: [PATCH 52/68] fix version string --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3e0c7b5c..3928703a 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "^7.1", "symfony-cmf/routing": "^2.1.0", - "symfony/framework-bundle": "^^3.4 || ^4.1", + "symfony/framework-bundle": "^3.4 || ^4.1", "twig/twig": "^1.35 || ^2.4.4" }, "require-dev": { From 0aa620f388d65fa0cefcd700f7d274a7a64a3841 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Mon, 11 Feb 2019 00:39:34 +0100 Subject: [PATCH 53/68] check on null before --- src/Model/Route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Route.php b/src/Model/Route.php index c0648158..f30c38a1 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -228,7 +228,7 @@ public function getPath() */ public function setPath($pattern) { - if (0 !== strpos($pattern, $this->getStaticPrefix())) { + if (null === $pattern || 0 !== strpos($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, From d8b9f848284cb07678b53491ae5121c1d77af5d7 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Mon, 11 Feb 2019 08:34:43 +0100 Subject: [PATCH 54/68] DevKit updates --- .php_cs.dist | 1 - .travis.yml | 2 -- README.md | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 9ccddb21..5759af56 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -45,7 +45,6 @@ $rules = [ 'void_return' => null, 'strict_comparison' => true, 'strict_param' => true, - 'php_unit_strict' => true, ]; diff --git a/.travis.yml b/.travis.yml index a6e5ef18..aa09e1e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,8 +45,6 @@ matrix: - php: 7.1 env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" - - php: 7.2 - env: SYMFONY_VERSION=4.0.* - php: 7.2 env: SYMFONY_VERSION=4.1.* - env: TARGET=test_installation diff --git a/README.md b/README.md index dcc48a3f..76f06a68 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ controller for redirection routes. ## Requirements * PHP 7.1 / 7.2 / 7.3 -* Symfony 3.4 / 4.0 / 4.1 / 4.2 +* Symfony 3.4 / 4.1 / 4.2 * See also the `require` section of [composer.json](composer.json) ## Documentation From db203e7da0cd0f0e39032d7dd2ad167828254d5a Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Mon, 11 Feb 2019 08:35:33 +0100 Subject: [PATCH 55/68] string type constraint instead of null check --- src/Model/Route.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Route.php b/src/Model/Route.php index f30c38a1..732d2d00 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -226,9 +226,9 @@ public function getPath() * When using PHPCR-ODM, make sure to persist the route before calling this * to have the id field initialized. */ - public function setPath($pattern) + public function setPath(string $pattern) { - if (null === $pattern || 0 !== strpos($pattern, $this->getStaticPrefix())) { + if (0 !== strpos($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, From fe9b49b8cacd553119561634b542f275388306fb Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 26 Feb 2019 01:29:55 +0100 Subject: [PATCH 56/68] add changelog entry --- .styleci.yml | 2 +- .travis.yml | 2 +- CHANGELOG.md | 7 ++++++- Makefile | 2 +- src/Model/Route.php | 4 ++-- src/Resources/meta/LICENSE | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.styleci.yml b/.styleci.yml index 2bdb04b1..c721eb61 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -7,7 +7,7 @@ ############################################################################ # This file is part of the Symfony CMF package. # # # -# (c) 2011-2017 Symfony CMF # +# (c) Symfony CMF # # # # For the full copyright and license information, please view the LICENSE # # file that was distributed with this source code. # diff --git a/.travis.yml b/.travis.yml index aa09e1e3..69a41315 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ ############################################################################ # This file is part of the Symfony CMF package. # # # -# (c) 2011-2017 Symfony CMF # +# (c) Symfony CMF # # # # For the full copyright and license information, please view the LICENSE # # file that was distributed with this source code. # diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e60f051..5bf8cfe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,12 @@ Changelog 2.2.0(ureleased) --------------- -* **YYYY-MM-DD**: + +* introduce PHPCS for style checks again +* Symfony 4.2 combustibility verified through tests, Symfony 4.3 allowed to break but on watch in tests +* drop Symfony 2.8 support +* make use of PHPUnit 6 +* **2015-02-26**: 2.1.1 ----- diff --git a/Makefile b/Makefile index f3a58808..dab6cf08 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ############################################################################ # This file is part of the Symfony CMF package. # # # -# (c) 2011-2017 Symfony CMF # +# (c) Symfony CMF # # # # For the full copyright and license information, please view the LICENSE # # file that was distributed with this source code. # diff --git a/src/Model/Route.php b/src/Model/Route.php index 732d2d00..66749d4c 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -226,9 +226,9 @@ public function getPath() * When using PHPCR-ODM, make sure to persist the route before calling this * to have the id field initialized. */ - public function setPath(string $pattern) + public function setPath($pattern) { - if (0 !== strpos($pattern, $this->getStaticPrefix())) { + if (!is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, diff --git a/src/Resources/meta/LICENSE b/src/Resources/meta/LICENSE index 38a9702f..d48ff23d 100644 --- a/src/Resources/meta/LICENSE +++ b/src/Resources/meta/LICENSE @@ -2,7 +2,7 @@ Symfony CMF Routing Bundle The MIT License - Copyright (c) 2011-2017 Symfony CMF + Copyright (c) Symfony CMF Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 182307bbdab0607ac4951e41e5eb476c90b1fc00 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 26 Feb 2019 01:32:46 +0100 Subject: [PATCH 57/68] add dates to changelog --- CHANGELOG.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bf8cfe7..204caead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,10 @@ Changelog 2.2.0(ureleased) --------------- - -* introduce PHPCS for style checks again -* Symfony 4.2 combustibility verified through tests, Symfony 4.3 allowed to break but on watch in tests -* drop Symfony 2.8 support -* make use of PHPUnit 6 -* **2015-02-26**: +* **2015-02-26**:introduce PHPCS for style checks again +* **2015-02-26**: Symfony 4.2 combustibility verified through tests, Symfony 4.3 allowed to break but on watch in tests +* **2015-02-26**: drop Symfony 2.8 support +* **2015-02-26**: make use of PHPUnit 6 2.1.1 ----- From d9a61f93c34991d8579d8064a9bf1aca08b55cca Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 26 Feb 2019 13:17:58 +0100 Subject: [PATCH 58/68] also add a null check --- src/Model/Route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Route.php b/src/Model/Route.php index 66749d4c..742041db 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -228,7 +228,7 @@ public function getPath() */ public function setPath($pattern) { - if (!is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { + if (null === $pattern || !is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, From 8903b8142e356fe833e5091b269ae27843f8f62f Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 26 Feb 2019 16:05:11 +0100 Subject: [PATCH 59/68] should fix test for routing --- src/Doctrine/Phpcr/Route.php | 2 +- src/Model/Route.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Doctrine/Phpcr/Route.php b/src/Doctrine/Phpcr/Route.php index f919a9c3..994b1931 100644 --- a/src/Doctrine/Phpcr/Route.php +++ b/src/Doctrine/Phpcr/Route.php @@ -233,7 +233,7 @@ public function getStaticPrefix() */ public function generateStaticPrefix($id, $idPrefix) { - if ('' === $idPrefix) { + if (null === $idPrefix || '' === $idPrefix) { throw new \LogicException('Can not determine the prefix. Either this is a new, unpersisted document or the listener that calls setPrefix is not set up correctly.'); } diff --git a/src/Model/Route.php b/src/Model/Route.php index 742041db..66749d4c 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -228,7 +228,7 @@ public function getPath() */ public function setPath($pattern) { - if (null === $pattern || !is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { + if (!is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, From 9c0b5a3b692ffde9176fde1ac4cb9401f860bbf5 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 26 Feb 2019 16:22:19 +0100 Subject: [PATCH 60/68] Some style changes --- .gitignore | 1 + src/DependencyInjection/CmfRoutingExtension.php | 2 +- src/Model/Route.php | 4 ++-- src/Routing/DynamicRouter.php | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 17e383e5..aed6b681 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ tests/Fixtures/App/var/ build/ .roles/ /.php_cs +.php_cs.cache diff --git a/src/DependencyInjection/CmfRoutingExtension.php b/src/DependencyInjection/CmfRoutingExtension.php index 4fc74ff5..19002ba4 100644 --- a/src/DependencyInjection/CmfRoutingExtension.php +++ b/src/DependencyInjection/CmfRoutingExtension.php @@ -79,7 +79,7 @@ private function setupFormTypes(array $config, ContainerBuilder $container, Load { $loader->load('form-type.xml'); - if (array_key_exists('dynamic', $config)) { + if (\array_key_exists('dynamic', $config)) { $routeTypeTypeDefinition = $container->getDefinition('cmf_routing.route_type_form_type'); foreach (array_keys($config['dynamic']['controllers_by_type']) as $routeType) { diff --git a/src/Model/Route.php b/src/Model/Route.php index 66749d4c..d5735fd9 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -186,7 +186,7 @@ public function getOption($name) public function getOptions() { $options = parent::getOptions(); - if (!array_key_exists('compiler_class', $options)) { + if (!\array_key_exists('compiler_class', $options)) { $options['compiler_class'] = RouteCompiler::class; } foreach ($options as $key => &$value) { @@ -228,7 +228,7 @@ public function getPath() */ public function setPath($pattern) { - if (!is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { + if (!\is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, diff --git a/src/Routing/DynamicRouter.php b/src/Routing/DynamicRouter.php index 2cb7fdeb..506388fb 100644 --- a/src/Routing/DynamicRouter.php +++ b/src/Routing/DynamicRouter.php @@ -117,17 +117,17 @@ protected function cleanDefaults($defaults, Request $request = null) $request = $this->getRequest(); } - if (array_key_exists(RouteObjectInterface::ROUTE_OBJECT, $defaults)) { + if (\array_key_exists(RouteObjectInterface::ROUTE_OBJECT, $defaults)) { $request->attributes->set(self::ROUTE_KEY, $defaults[RouteObjectInterface::ROUTE_OBJECT]); unset($defaults[RouteObjectInterface::ROUTE_OBJECT]); } - if (array_key_exists(RouteObjectInterface::CONTENT_OBJECT, $defaults)) { + if (\array_key_exists(RouteObjectInterface::CONTENT_OBJECT, $defaults)) { $request->attributes->set(self::CONTENT_KEY, $defaults[RouteObjectInterface::CONTENT_OBJECT]); unset($defaults[RouteObjectInterface::CONTENT_OBJECT]); } - if (array_key_exists(RouteObjectInterface::TEMPLATE_NAME, $defaults)) { + if (\array_key_exists(RouteObjectInterface::TEMPLATE_NAME, $defaults)) { $request->attributes->set(self::CONTENT_TEMPLATE, $defaults[RouteObjectInterface::TEMPLATE_NAME]); // contentTemplate is deprecated as of version 2.0, to be removed in 3.0 From ded81f8cbfc300f147497380ee7fb3e2c848930f Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 27 Feb 2019 06:50:09 +0100 Subject: [PATCH 61/68] cs fixes --- src/Doctrine/Phpcr/PrefixCandidates.php | 2 +- src/Doctrine/Phpcr/RedirectRoute.php | 2 +- src/Doctrine/Phpcr/Route.php | 2 +- src/Model/Route.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Doctrine/Phpcr/PrefixCandidates.php b/src/Doctrine/Phpcr/PrefixCandidates.php index 03c4075f..a46fb04d 100644 --- a/src/Doctrine/Phpcr/PrefixCandidates.php +++ b/src/Doctrine/Phpcr/PrefixCandidates.php @@ -112,7 +112,7 @@ public function getCandidates(Request $request) $locale = $this->determineLocale($url); if ($locale) { - $url = substr($url, \strlen($locale) + 1); + $url = strpos($url, \strlen($locale) + 1); foreach ($this->getPrefixes() as $prefix) { $candidates = array_unique(array_merge($candidates, $this->getCandidatesFor($url, $prefix))); } diff --git a/src/Doctrine/Phpcr/RedirectRoute.php b/src/Doctrine/Phpcr/RedirectRoute.php index ad2c9df8..a57121b3 100644 --- a/src/Doctrine/Phpcr/RedirectRoute.php +++ b/src/Doctrine/Phpcr/RedirectRoute.php @@ -224,7 +224,7 @@ public function generateStaticPrefix($id, $idPrefix) throw new \LogicException("The id prefix '$idPrefix' does not match the route document path '$id'"); } - $url = substr($id, \strlen($idPrefix)); + $url = strpos($id, \strlen($idPrefix)); if ('' === $url) { $url = '/'; } diff --git a/src/Doctrine/Phpcr/Route.php b/src/Doctrine/Phpcr/Route.php index 994b1931..f1ba20aa 100644 --- a/src/Doctrine/Phpcr/Route.php +++ b/src/Doctrine/Phpcr/Route.php @@ -241,7 +241,7 @@ public function generateStaticPrefix($id, $idPrefix) throw new \LogicException("The id prefix '$idPrefix' does not match the route document path '$id'"); } - $url = substr($id, \strlen($idPrefix)); + $url = strpos($id, \strlen($idPrefix)); if (!$url) { $url = '/'; } diff --git a/src/Model/Route.php b/src/Model/Route.php index d5735fd9..7e6b8482 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -236,7 +236,7 @@ public function setPath($pattern) )); } - return $this->setVariablePattern(substr($pattern, \strlen($this->getStaticPrefix()))); + return $this->setVariablePattern(strpos($pattern, \strlen($this->getStaticPrefix()))); } /** From 95e803399cf107607d615337b42eaabe39a17e13 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 27 Feb 2019 07:08:14 +0100 Subject: [PATCH 62/68] revert stupid string replace --- src/Doctrine/Phpcr/PrefixCandidates.php | 2 +- src/Doctrine/Phpcr/RedirectRoute.php | 2 +- src/Doctrine/Phpcr/Route.php | 2 +- src/Model/Route.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Doctrine/Phpcr/PrefixCandidates.php b/src/Doctrine/Phpcr/PrefixCandidates.php index a46fb04d..03c4075f 100644 --- a/src/Doctrine/Phpcr/PrefixCandidates.php +++ b/src/Doctrine/Phpcr/PrefixCandidates.php @@ -112,7 +112,7 @@ public function getCandidates(Request $request) $locale = $this->determineLocale($url); if ($locale) { - $url = strpos($url, \strlen($locale) + 1); + $url = substr($url, \strlen($locale) + 1); foreach ($this->getPrefixes() as $prefix) { $candidates = array_unique(array_merge($candidates, $this->getCandidatesFor($url, $prefix))); } diff --git a/src/Doctrine/Phpcr/RedirectRoute.php b/src/Doctrine/Phpcr/RedirectRoute.php index a57121b3..ad2c9df8 100644 --- a/src/Doctrine/Phpcr/RedirectRoute.php +++ b/src/Doctrine/Phpcr/RedirectRoute.php @@ -224,7 +224,7 @@ public function generateStaticPrefix($id, $idPrefix) throw new \LogicException("The id prefix '$idPrefix' does not match the route document path '$id'"); } - $url = strpos($id, \strlen($idPrefix)); + $url = substr($id, \strlen($idPrefix)); if ('' === $url) { $url = '/'; } diff --git a/src/Doctrine/Phpcr/Route.php b/src/Doctrine/Phpcr/Route.php index f1ba20aa..994b1931 100644 --- a/src/Doctrine/Phpcr/Route.php +++ b/src/Doctrine/Phpcr/Route.php @@ -241,7 +241,7 @@ public function generateStaticPrefix($id, $idPrefix) throw new \LogicException("The id prefix '$idPrefix' does not match the route document path '$id'"); } - $url = strpos($id, \strlen($idPrefix)); + $url = substr($id, \strlen($idPrefix)); if (!$url) { $url = '/'; } diff --git a/src/Model/Route.php b/src/Model/Route.php index 7e6b8482..4b67f400 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -228,7 +228,7 @@ public function getPath() */ public function setPath($pattern) { - if (!\is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { + if (!\is_string($pattern) || 0 !== substr($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, @@ -236,7 +236,7 @@ public function setPath($pattern) )); } - return $this->setVariablePattern(strpos($pattern, \strlen($this->getStaticPrefix()))); + return $this->setVariablePattern(substr($pattern, \strlen($this->getStaticPrefix()))); } /** From e85298151c1b78fbd76f3ce92241fe518fc3ae39 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 27 Feb 2019 09:04:07 +0100 Subject: [PATCH 63/68] revert strpos -> substr change --- src/Model/Route.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Route.php b/src/Model/Route.php index 4b67f400..d5735fd9 100644 --- a/src/Model/Route.php +++ b/src/Model/Route.php @@ -228,7 +228,7 @@ public function getPath() */ public function setPath($pattern) { - if (!\is_string($pattern) || 0 !== substr($pattern, $this->getStaticPrefix())) { + if (!\is_string($pattern) || 0 !== strpos($pattern, $this->getStaticPrefix())) { throw new \InvalidArgumentException(sprintf( 'You can not set pattern "%s" for this route with a static prefix of "%s". First update the static prefix or directly use setVariablePattern.', $pattern, From 8a471da73e2022399037b147ef919292468db8fc Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 28 Feb 2019 04:55:06 +0100 Subject: [PATCH 64/68] also cs fix change on master through an rebase --- src/Doctrine/Phpcr/PrefixCandidates.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Doctrine/Phpcr/PrefixCandidates.php b/src/Doctrine/Phpcr/PrefixCandidates.php index 03c4075f..c313a617 100644 --- a/src/Doctrine/Phpcr/PrefixCandidates.php +++ b/src/Doctrine/Phpcr/PrefixCandidates.php @@ -176,12 +176,12 @@ public function setManagerName($manager) protected function isCandidateValid($candidate) { // Candidates cannot start or end with a space in Jackrabbit. - if (' ' === \substr($candidate, 0, 1) || ' ' === \substr($candidate, -1)) { + if (' ' === substr($candidate, 0, 1) || ' ' === substr($candidate, -1)) { return false; } // Jackrabbit does not allow spaces before or after the path separator. - if (false !== \strpos($candidate, ' /') || false !== \strpos($candidate, '/ ')) { + if (false !== strpos($candidate, ' /') || false !== strpos($candidate, '/ ')) { return false; } From a538d030c3b00ad884b057a41c494080e7576cc5 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 28 Feb 2019 05:07:02 +0100 Subject: [PATCH 65/68] adjust some tests comming from master --- src/DependencyInjection/CmfRoutingExtension.php | 2 +- .../Compiler/TemplatingValidatorPassTest.php | 4 ++-- tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php | 2 +- tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/DependencyInjection/CmfRoutingExtension.php b/src/DependencyInjection/CmfRoutingExtension.php index 19002ba4..456aaa10 100644 --- a/src/DependencyInjection/CmfRoutingExtension.php +++ b/src/DependencyInjection/CmfRoutingExtension.php @@ -71,7 +71,7 @@ private function setupChainRouter(array $config, ContainerBuilder $container, Lo // add the routers defined in the configuration mapping $router = $container->getDefinition('cmf_routing.router'); foreach ($config['chain']['routers_by_id'] as $id => $priority) { - $router->addMethodCall('add', [new Reference($id), trim($priority)]); + $router->addMethodCall('add', [new Reference($id), trim((string) $priority)]); } } diff --git a/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php b/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php index 633f195b..55a8fec5 100644 --- a/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php +++ b/tests/Unit/DependencyInjection/Compiler/TemplatingValidatorPassTest.php @@ -40,8 +40,8 @@ public function testReplacesValidator() $definition = $this->container->getDefinition('cmf_routing.validator.route_defaults'); - $this->assertSame(RouteDefaultsTemplatingValidator::class, $definition->getClass()); - $this->assertSame(['foo', new Reference('templating')], $definition->getArguments()); + $this->assertEquals(RouteDefaultsTemplatingValidator::class, $definition->getClass()); + $this->assertEquals(['foo', new Reference('templating')], $definition->getArguments()); } /** diff --git a/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php b/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php index dbfc5f94..09217667 100644 --- a/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php +++ b/tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php @@ -63,7 +63,7 @@ public function testNoRoute() $originalArgs = clone $args; $this->listener->postLoad($args); - $this->assertSame($originalArgs, $args); + $this->assertEquals($originalArgs, $args); } public function testPostLoad() diff --git a/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php b/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php index 60692fea..5eaecfcb 100644 --- a/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php +++ b/tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php @@ -61,7 +61,7 @@ public function testNoRoute() $originalArgs = clone $args; $this->listener->postLoad($args); $this->listener->postPersist($args); - $this->assertSame($originalArgs, $args); + $this->assertEquals($originalArgs, $args); } public function testNoPrefixMatch() From 1cde57e328fdd5b52276421b374e632e7b086747 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Thu, 28 Feb 2019 20:27:12 +0100 Subject: [PATCH 66/68] fix changelog entry --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 204caead..63b4d73a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,7 @@ Changelog 2.2.0(ureleased) --------------- -* **2015-02-26**:introduce PHPCS for style checks again -* **2015-02-26**: Symfony 4.2 combustibility verified through tests, Symfony 4.3 allowed to break but on watch in tests -* **2015-02-26**: drop Symfony 2.8 support -* **2015-02-26**: make use of PHPUnit 6 +* **2019-02-28**: Symfony 4.2 support without warnings 2.1.1 ----- From 836ae686d74ca4eb6f3e38f3a814b091402b6105 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 1 Mar 2019 15:59:13 +0100 Subject: [PATCH 67/68] DevKit updates --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 69a41315..77a1266c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,8 +31,8 @@ env: global: - SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - - SYMFONY_PHPUNIT_VERSION=6 - - PHPUNIT_VERSION=6 + - SYMFONY_PHPUNIT_VERSION=7 + - PHPUNIT_VERSION=7 - TARGET=test matrix: From 759c9c696403ab562a6f9d8e5750ab102e23eadf Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 1 Mar 2019 23:17:51 +0100 Subject: [PATCH 68/68] use higher symfony dependency/config testing versions --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3928703a..892290ed 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ "require-dev": { "doctrine/phpcr-odm": "^1.4.2 || ^2.0", "symfony/phpunit-bridge": "^4.2.2", - "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", - "matthiasnoback/symfony-config-test": "^3.1.1", + "matthiasnoback/symfony-dependency-injection-test": "^3.1", + "matthiasnoback/symfony-config-test": "^4.0.1", "doctrine/orm": "^2.5", "symfony-cmf/testing": "^2.1.11", "doctrine/data-fixtures": "^1.0.0",