From 341391d9a858832c6957d4ec11b77569b797b7e2 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Tue, 29 Jan 2019 06:59:59 +0100 Subject: [PATCH 1/5] DevKit updates --- .travis.yml | 26 ++++++++++---------- Makefile | 3 +-- README.md | 49 +++++++++++++++++++++----------------- composer.json | 8 +++---- src/Resources/meta/LICENSE | 2 +- 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9636969..7b4be7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,27 +26,25 @@ 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\RoutingAutoBundle\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.* - - env: TEST_INSTALLATION=true + - php: "7.3" + 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: STABILITY="dev" SYMFONY_VERSION="4.0.*" + - php: "7.3" + env: STABILITY="dev" SYMFONY_VERSION="4.1.*" fast_finish: true allow_failures: - - env: TEST_INSTALLATION=true before_install: - phpenv config-rm xdebug.ini || true diff --git a/Makefile b/Makefile index 81d41db..176b957 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,9 @@ list: @echo 'unit_tests: will run unit tests only' @echo 'functional_tests_phpcr: will run functional tests with PHPCR' - @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/test_installation.mk .PHONY: test test: unit_tests functional_tests_phpcr diff --git a/README.md b/README.md index 15ccbfd..cee41a0 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,13 @@ [![Monthly Downloads](https://poser.pugx.org/symfony-cmf/routing-auto-bundle/d/monthly)](https://packagist.org/packages/symfony-cmf/routing-auto-bundle) [![Daily Downloads](https://poser.pugx.org/symfony-cmf/routing-auto-bundle/d/daily)](https://packagist.org/packages/symfony-cmf/routing-auto-bundle) -Branch | Travis | Coveralls | ------- | ------ | --------- | -master | [![Build Status][travis_unstable_badge]][travis_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | +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] | -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). This bundle automatically creates and manages routes for configured persisted document classes. @@ -20,24 +22,24 @@ This bundle automatically creates and manages routes for configured persisted do ## 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-auto-bundle Documentation](http://symfony.com/doc/master/cmf/bundles/routing-auto-bundle/index.html) +* [symfony-cmf/routing-auto-bundle Documentation](https://symfony.com/doc/master/cmf/bundles/routing-auto-bundle/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 -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 @@ -46,7 +48,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 @@ -56,14 +58,17 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -[travis_legacy_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=master -[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=master -[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=master -[travis_link]: https://travis-ci.org/symfony-cmf/routing-auto-bundle - -[coveralls_legacy_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=master -[coveralls_legacy_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=master -[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=master -[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=master -[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=master -[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=master +[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=2.1 +[travis_stable_link]: https://travis-ci.org/symfony-cmf/routing-auto-bundle +[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=3.0-dev +[travis_unstable_link]: https://travis-ci.org/symfony-cmf/routing-auto-bundle + +[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=2.1 +[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=2.1 +[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=3.0-dev +[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=3.0-dev + +[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/badges/quality-score.png?b=2.1 +[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/?branch=2.1 +[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/badges/quality-score.png?b=3.0-dev +[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/?branch=3.0-dev diff --git a/composer.json b/composer.json index 1ea810c..01c42ee 100644 --- a/composer.json +++ b/composer.json @@ -10,16 +10,16 @@ } ], "require": { - "php": "^7.1", - "symfony/framework-bundle": "^2.8 || ^3.3 || ^4.0", + "php": "^7.2", + "symfony/framework-bundle": "^3.4 || ^4.0", "symfony-cmf/routing-auto": "^2.0", "symfony-cmf/routing-bundle": "^2.0", "aferrandini/urlizer": "1.0.*", "phpdocumentor/reflection-docblock": "^3.1, !=3.2.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.2.2", - "symfony/yaml": "^2.8 || ^3.3 || ^4.0", + "symfony/phpunit-bridge": "^3.4 || ^4.0", + "symfony/yaml": "^3.4 || ^4.0", "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", "matthiasnoback/symfony-config-test": "^3.1.1", "symfony-cmf/testing": "^2.1.11", diff --git a/src/Resources/meta/LICENSE b/src/Resources/meta/LICENSE index 367f0a8..19976c8 100644 --- a/src/Resources/meta/LICENSE +++ b/src/Resources/meta/LICENSE @@ -1,4 +1,4 @@ -Symfony Cmf Routing Auto Bundle +Symfony CMF Routing Auto Bundle The MIT License From 79500e4bdab87e2917e2cfff8da62a22acb9835b Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 23:42:58 +0100 Subject: [PATCH 2/5] DevKit updates --- .travis.yml | 31 +++++++++++++++++++------------ Makefile | 10 ++++++++-- README.md | 14 +++++++------- composer.json | 4 ++-- 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7b4be7d..1f87edd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,8 @@ language: php php: - 7.1 - + - 7.2 + - 7.3 sudo: false cache: @@ -28,23 +29,29 @@ cache: env: matrix: SYMFONY_VERSION=4.2.* global: - - SYMFONY_DEPRECATIONS_HELPER="weak" + - SYMFONY_DEPRECATIONS_HELPER=weak - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" - - KERNEL_CLASS=Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel - - SYMFONY_PHPUNIT_VERSION=5.7.26 + - SYMFONY_PHPUNIT_VERSION=6 + - TEST_INSTALLATION=false matrix: include: - - php: "7.3" - 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: STABILITY="dev" SYMFONY_VERSION="4.0.*" - - php: "7.3" - env: STABILITY="dev" 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.* + - env: TEST_INSTALLATION=true before_install: - phpenv config-rm xdebug.ini || true diff --git a/Makefile b/Makefile index 176b957..47db01f 100644 --- a/Makefile +++ b/Makefile @@ -14,21 +14,27 @@ ############################################################################ 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} endif PACKAGE=symfony-cmf/routing-auto-bundle -export KERNEL_CLASS=Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel + list: @echo 'test: will run all tests' @echo 'unit_tests: will run unit tests only' @echo 'functional_tests_phpcr: will run functional tests with PHPCR' - + @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/test_installation.mk .PHONY: test test: unit_tests functional_tests_phpcr diff --git a/README.md b/README.md index cee41a0..d3ab49b 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 @@ -22,7 +22,7 @@ This bundle automatically creates and manages routes for configured persisted do ## 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) @@ -60,15 +60,15 @@ This package is available under the [MIT license](src/Resources/meta/LICENSE). [travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=2.1 [travis_stable_link]: https://travis-ci.org/symfony-cmf/routing-auto-bundle -[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=3.0-dev +[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-auto-bundle.svg?branch=dev-master [travis_unstable_link]: https://travis-ci.org/symfony-cmf/routing-auto-bundle [coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=2.1 [coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=2.1 -[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=3.0-dev -[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=3.0-dev +[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto-bundle/badge.svg?branch=dev-master +[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-auto-bundle?branch=dev-master [scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/badges/quality-score.png?b=2.1 [scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/?branch=2.1 -[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/badges/quality-score.png?b=3.0-dev -[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/?branch=3.0-dev +[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/badges/quality-score.png?b=dev-master +[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/routing-auto-bundle/?branch=dev-master diff --git a/composer.json b/composer.json index 01c42ee..818a382 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.1", "symfony/framework-bundle": "^3.4 || ^4.0", "symfony-cmf/routing-auto": "^2.0", "symfony-cmf/routing-bundle": "^2.0", @@ -18,7 +18,7 @@ "phpdocumentor/reflection-docblock": "^3.1, !=3.2.0" }, "require-dev": { - "symfony/phpunit-bridge": "^3.4 || ^4.0", + "symfony/phpunit-bridge": "^4.2.2", "symfony/yaml": "^3.4 || ^4.0", "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", "matthiasnoback/symfony-config-test": "^3.1.1", From c6193b470424e877b82a9500ca363541165f3076 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 1 Mar 2019 16:54:02 +0100 Subject: [PATCH 3/5] DevKit updates --- .php_cs.dist | 64 +++++++++++++++++++++++++++++++++++ .styleci.yml | 2 +- .travis.yml | 29 +++++++++------- .travis/after_success_test.sh | 5 +++ .travis/install_lint.sh | 11 ++++++ .travis/install_test.sh | 19 +++++++++++ Makefile | 64 +++++++++++++++++++++++++++++------ README.md | 2 +- composer.json | 4 +-- phpunit.xml.dist | 46 ++++++++++++------------- src/Resources/meta/LICENSE | 2 +- 11 files changed, 197 insertions(+), 51 deletions(-) create mode 100644 .php_cs.dist create mode 100755 .travis/after_success_test.sh create mode 100755 .travis/install_lint.sh create mode 100755 .travis/install_test.sh diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..5759af5 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,64 @@ + 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, +]; + + +$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/.styleci.yml b/.styleci.yml index 2bdb04b..c721eb6 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 1f87edd..58e7ced 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. # @@ -29,29 +29,30 @@ 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 + - SYMFONY_PHPUNIT_VERSION=7 + - PHPUNIT_VERSION=7 + - TARGET=test matrix: include: + - env: TARGET=lint - 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.* + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER="/.*each.*/" + - 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 @@ -61,9 +62,13 @@ 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 -script: - - if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi +install: + - if [ -x .travis/install_${TARGET}.sh ]; then .travis/install_${TARGET}.sh; fi; + +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 0000000..9837420 --- /dev/null +++ b/.travis/after_success_test.sh @@ -0,0 +1,5 @@ + +#!/usr/bin/env sh +set -ev + +coveralls -v diff --git a/.travis/install_lint.sh b/.travis/install_lint.sh new file mode 100755 index 0000000..864c751 --- /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 0000000..a033500 --- /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 47db01f..41d65bf 100644 --- a/Makefile +++ b/Makefile @@ -7,34 +7,76 @@ ############################################################################ # 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. # ############################################################################ 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} endif PACKAGE=symfony-cmf/routing-auto-bundle +HAS_XDEBUG=$(shell php --modules|grep --quiet xdebug;echo $$?) list: @echo 'test: will run all tests' @echo 'unit_tests: will run unit tests only' @echo 'functional_tests_phpcr: will run functional tests with PHPCR' - @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/test_installation.mk + @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) + 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) + TEST_DEPENDENCIES := $(TEST_DEPENDENCIES)" functional_tests_phpcr" + 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 .PHONY: test -test: unit_tests functional_tests_phpcr +test: build/xdebug-filter.php$ +ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),) + @make unit_tests +endif +ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),) + @make functional_tests_phpcr +endif + +lint-php: + php-cs-fixer fix --ansi --verbose --diff --dry-run +.PHONY: lint-php + +lint: lint-composer lint-php +.PHONY: lint + +lint-composer: + composer validate +.PHONY: lint-composer + +cs-fix: cs-fix-php +.PHONY: cs-fix + +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 $@ +endif diff --git a/README.md b/README.md index d3ab49b..09972af 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This bundle automatically creates and manages routes for configured persisted do ## 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 diff --git a/composer.json b/composer.json index 818a382..d42178a 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^7.1", - "symfony/framework-bundle": "^3.4 || ^4.0", + "symfony/framework-bundle": "^3.4 || ^4.1", "symfony-cmf/routing-auto": "^2.0", "symfony-cmf/routing-bundle": "^2.0", "aferrandini/urlizer": "1.0.*", @@ -19,7 +19,7 @@ }, "require-dev": { "symfony/phpunit-bridge": "^4.2.2", - "symfony/yaml": "^3.4 || ^4.0", + "symfony/yaml": "^3.4 || ^4.1", "matthiasnoback/symfony-dependency-injection-test": "^2.3.1", "matthiasnoback/symfony-config-test": "^3.1.1", "symfony-cmf/testing": "^2.1.11", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e2bb8a1..7827400 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,35 +2,35 @@ + colors="true" + bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php" +> - - + + + + ./tests/Unit - + - ./tests/WebTest ./tests/Functional + ./tests/Functional/Doctrine/Orm - + + + + + + src/ + + Resources/ + + + - - - . - - *Bundle.php - Resources/ - Admin/ - Tests/ - vendor/ - - - + - - - + + diff --git a/src/Resources/meta/LICENSE b/src/Resources/meta/LICENSE index 19976c8..897aaa1 100644 --- a/src/Resources/meta/LICENSE +++ b/src/Resources/meta/LICENSE @@ -2,7 +2,7 @@ Symfony CMF Routing Auto 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 c0bc0746363e2c5cd85d6f6fe4eee825031d11f0 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 1 Mar 2019 23:41:40 +0100 Subject: [PATCH 4/5] cs fixes for php, higher testing library versions --- .gitignore | 2 + composer.json | 4 +- src/Adapter/PhpcrOdmAdapter.php | 12 +++-- src/CmfRoutingAutoBundle.php | 4 +- src/Command/RefreshCommand.php | 6 ++- src/Controller/RedirectController.php | 4 +- .../CmfRoutingAutoExtension.php | 16 +++--- .../Compiler/AdapterPass.php | 4 +- .../Compiler/ServicePass.php | 4 +- src/DependencyInjection/Configuration.php | 4 +- src/Doctrine/Phpcr/AutoRouteListener.php | 38 +++++++------- src/Model/AutoRoute.php | 6 ++- tests/Functional/BaseTestCase.php | 4 +- .../Functional/Command/RefreshCommandTest.php | 34 ++++++------ .../EventListener/AutoRouteListenerTest.php | 52 ++++++++++--------- tests/Unit/Adapter/PhpcrOdmAdapterTest.php | 4 +- .../CmfRoutingAutoExtensionTest.php | 4 +- .../Compiler/AutoRoutePassTest.php | 14 ++--- .../Compiler/ServicePassTest.php | 15 +++--- .../DependencyInjection/ConfigurationTest.php | 24 +++++---- .../DependencyInjection/XmlSchemaTest.php | 4 +- tests/WebTest/RedirectTest.php | 4 +- 22 files changed, 152 insertions(+), 111 deletions(-) diff --git a/.gitignore b/.gitignore index f283645..ded3d23 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ tests/Fixtures/App/var !tests/Fixtures/App/var/.gitempty composer.lock vendor +build/ +.php_cs.cache diff --git a/composer.json b/composer.json index d42178a..08658c1 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ "require-dev": { "symfony/phpunit-bridge": "^4.2.2", "symfony/yaml": "^3.4 || ^4.1", - "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", "symfony-cmf/testing": "^2.1.11", "doctrine/phpcr-odm": "^1.4.2 || ^2.0" }, diff --git a/src/Adapter/PhpcrOdmAdapter.php b/src/Adapter/PhpcrOdmAdapter.php index ff99887..2432e3f 100644 --- a/src/Adapter/PhpcrOdmAdapter.php +++ b/src/Adapter/PhpcrOdmAdapter.php @@ -1,9 +1,11 @@ dm->getMetadataFactory()->getMetadataFor(get_class($contentDocument)); + $meta = $this->dm->getMetadataFactory()->getMetadataFor(\get_class($contentDocument)); return $this->dm->findTranslation($meta->getName(), $meta->getIdentifierValue($contentDocument), $locale); } @@ -157,7 +159,7 @@ public function createAutoRoute(UriContext $uriContext, $locale) 'Encountered existing PHPCR-ODM document at path "%s" of class "%s", the route tree should '. 'contain only instances of AutoRouteInterface.', $path, - get_class($existingDocument) + \get_class($existingDocument) ) ); } @@ -275,7 +277,7 @@ private function migrateGenericToAutoRoute(Generic $document, $contentDocument, 'Failed to migrate existing, non-managed, PHPCR node at "%s" to a managed document implementing '. 'the AutoRouteInterface. It is an instance of "%s".', $document->getId(), - get_class($autoRoute) + \get_class($autoRoute) ) ); } diff --git a/src/CmfRoutingAutoBundle.php b/src/CmfRoutingAutoBundle.php index 273b62c..41387a1 100644 --- a/src/CmfRoutingAutoBundle.php +++ b/src/CmfRoutingAutoBundle.php @@ -1,9 +1,11 @@ - %sPersisting: %s %s', $dryRun ? '(dry run) ' : '', $autoRouteId, - '[...]'.substr(get_class($autoRoute), -10) + '[...]'.substr(\get_class($autoRoute), -10) )); } diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index 6c3eefd..090bcd3 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -1,9 +1,11 @@ setParameter('cmf_routing_auto.adapter_name', $adapterName); } + public function getNamespace() + { + return 'http://cmf.symfony.com/schema/dic/routing_auto'; + } + protected function findMappingFiles($bundles) { $resources = []; foreach ($bundles as $bundle) { $refl = new \ReflectionClass($bundle); - $bundlePath = dirname($refl->getFileName()); + $bundlePath = \dirname($refl->getFileName()); foreach (['xml', 'yml'] as $extension) { $path = $bundlePath.'/Resources/config/cmf_routing_auto.'.$extension; if (file_exists($path)) { @@ -93,9 +100,4 @@ protected function findMappingFiles($bundles) return $resources; } - - public function getNamespace() - { - return 'http://cmf.symfony.com/schema/dic/routing_auto'; - } } diff --git a/src/DependencyInjection/Compiler/AdapterPass.php b/src/DependencyInjection/Compiler/AdapterPass.php index 29fcb67..cc2ba07 100644 --- a/src/DependencyInjection/Compiler/AdapterPass.php +++ b/src/DependencyInjection/Compiler/AdapterPass.php @@ -1,9 +1,11 @@ container = $container; } - /** - * @return AutoRouteManager - */ - protected function getAutoRouteManager() - { - // lazy load the auto_route_manager service to prevent a cirular-reference - // to the document manager. - return $this->container->get('cmf_routing_auto.auto_route_manager'); - } - - protected function getMetadataFactory() - { - return $this->container->get('cmf_routing_auto.metadata.factory'); - } - public function onFlush(ManagerEventArgs $args) { /** @var $dm DocumentManager */ @@ -75,7 +62,7 @@ public function onFlush(ManagerEventArgs $args) // reset locale to the original locale if (null !== $locale) { - $dm->findTranslation(get_class($document), $uow->getDocumentId($document), $locale); + $dm->findTranslation(\get_class($document), $uow->getDocumentId($document), $locale); } } } @@ -112,10 +99,25 @@ public function endFlush(ManagerEventArgs $args) $this->postFlushDone = false; } + /** + * @return AutoRouteManager + */ + protected function getAutoRouteManager() + { + // lazy load the auto_route_manager service to prevent a cirular-reference + // to the document manager. + return $this->container->get('cmf_routing_auto.auto_route_manager'); + } + + protected function getMetadataFactory() + { + return $this->container->get('cmf_routing_auto.metadata.factory'); + } + private function isAutoRouteable($document) { try { - return (bool) $this->getMetadataFactory()->getMetadataForClass(get_class($document)); + return (bool) $this->getMetadataFactory()->getMetadataForClass(\get_class($document)); } catch (ClassNotMappedException $e) { return false; } diff --git a/src/Model/AutoRoute.php b/src/Model/AutoRoute.php index 9ea08a3..a2f07b1 100644 --- a/src/Model/AutoRoute.php +++ b/src/Model/AutoRoute.php @@ -1,9 +1,11 @@ createBlog(true); + + $application = $this->getApplication(); + $input = new ArrayInput([ + 'foo:bar', + ]); + $output = new NullOutput(); + //$output = new StreamOutput(fopen('php://stdout', 'w')); + $command = new RefreshCommand(); + $command->setApplication($application); + $command->run($input, $output); + } + protected function createBlog($withPosts = false) { $blog = new Blog(); @@ -42,19 +59,4 @@ protected function createBlog($withPosts = false) $this->getDm()->flush(); $this->getDm()->clear(); } - - public function testCommand() - { - $this->createBlog(true); - - $application = $this->getApplication(); - $input = new ArrayInput([ - 'foo:bar', - ]); - $output = new NullOutput(); - //$output = new StreamOutput(fopen('php://stdout', 'w')); - $command = new RefreshCommand(); - $command->setApplication($application); - $command->run($input, $output); - } } diff --git a/tests/Functional/EventListener/AutoRouteListenerTest.php b/tests/Functional/EventListener/AutoRouteListenerTest.php index 48a9d88..d6ee1a3 100644 --- a/tests/Functional/EventListener/AutoRouteListenerTest.php +++ b/tests/Functional/EventListener/AutoRouteListenerTest.php @@ -1,9 +1,11 @@ path = '/test/test-blog'; - $blog->title = 'Unit testing blog'; - - $this->getDm()->persist($blog); - - if ($withPosts) { - $post = new Post(); - $post->name = 'This is a post title'; - $post->title = 'This is a post title'; - $post->blog = $blog; - $post->date = new \DateTime('2013/03/21'); - $this->getDm()->persist($post); - } - - $this->getDm()->flush(); - $this->getDm()->clear(); - } - /** * It should persist the blog document and create an auto route. * It should set the defaults on the route. @@ -253,7 +234,7 @@ public function testMultilangArticle($data, $expectedPaths) $locales = array_keys($data); foreach ($expectedPaths as $i => $expectedPath) { - $localeIndex = $i % count($locales); + $localeIndex = $i % \count($locales); $expectedLocale = $locales[$localeIndex]; $route = $this->getDm()->find(null, $expectedPath); @@ -307,7 +288,7 @@ public function testMultilangArticleRemainsSameLocale() $this->getDm()->bindTranslation($article, 'fr'); // let current article be something else than the last bound locale - $this->getDm()->findTranslation(get_class($article), $this->getDm()->getUnitOfWork()->getDocumentId($article), 'en'); + $this->getDm()->findTranslation(\get_class($article), $this->getDm()->getUnitOfWork()->getDocumentId($article), 'en'); $this->getDm()->flush(); $this->getDm()->clear(); @@ -342,7 +323,7 @@ public function testUpdateMultilangArticle($data, $expectedPaths) $routes = $this->getDm()->getReferrers($article_de); // Multiply the expected paths by 3 because Article has 3 routes defined. - $this->assertCount(count($data) * 3, $routes); + $this->assertCount(\count($data) * 3, $routes); $this->getDm()->clear(); @@ -629,4 +610,25 @@ public function testGenericNodeShouldBeConvertedInAnAutoRouteNode() $this->getDm()->find(null, '/test/auto-route/blog/my-post') ); } + + protected function createBlog($withPosts = false) + { + $blog = new Blog(); + $blog->path = '/test/test-blog'; + $blog->title = 'Unit testing blog'; + + $this->getDm()->persist($blog); + + if ($withPosts) { + $post = new Post(); + $post->name = 'This is a post title'; + $post->title = 'This is a post title'; + $post->blog = $blog; + $post->date = new \DateTime('2013/03/21'); + $this->getDm()->persist($post); + } + + $this->getDm()->flush(); + $this->getDm()->clear(); + } } diff --git a/tests/Unit/Adapter/PhpcrOdmAdapterTest.php b/tests/Unit/Adapter/PhpcrOdmAdapterTest.php index c0fb185..8755a3e 100644 --- a/tests/Unit/Adapter/PhpcrOdmAdapterTest.php +++ b/tests/Unit/Adapter/PhpcrOdmAdapterTest.php @@ -1,9 +1,11 @@ addCompilerPass(new AdapterPass()); - } - public function testAdapterRegistrationUnknownAdapter() { $managerDef = new Definition(); @@ -56,4 +53,9 @@ public function testAdapterRegistration() $expectedAlias->setPublic(true); $this->assertEquals($expectedAlias, $this->container->getAlias('cmf_routing_auto.adapter')); } + + protected function registerCompilerPass(ContainerBuilder $container) + { + $container->addCompilerPass(new AdapterPass()); + } } diff --git a/tests/Unit/DependencyInjection/Compiler/ServicePassTest.php b/tests/Unit/DependencyInjection/Compiler/ServicePassTest.php index 33c71c3..41d5eb8 100644 --- a/tests/Unit/DependencyInjection/Compiler/ServicePassTest.php +++ b/tests/Unit/DependencyInjection/Compiler/ServicePassTest.php @@ -1,9 +1,11 @@ addCompilerPass(new ServicePass()); - } - public function testServiceRegistration() { $serviceRegistryDefinition = new Definition(); @@ -42,4 +38,9 @@ public function testServiceRegistration() ] ); } + + protected function registerCompilerPass(ContainerBuilder $container) + { + $container->addCompilerPass(new ServicePass()); + } } diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index 2e5767f..cd50b30 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -1,9 +1,11 @@ assertProcessedConfigurationEquals($expectedConfiguration, [$source]); } } + + protected function getContainerExtension() + { + return new CmfRoutingAutoExtension(); + } + + protected function getConfiguration() + { + return new Configuration(); + } } diff --git a/tests/Unit/DependencyInjection/XmlSchemaTest.php b/tests/Unit/DependencyInjection/XmlSchemaTest.php index 0506546..2c221ae 100644 --- a/tests/Unit/DependencyInjection/XmlSchemaTest.php +++ b/tests/Unit/DependencyInjection/XmlSchemaTest.php @@ -1,9 +1,11 @@ Date: Fri, 1 Mar 2019 23:56:25 +0100 Subject: [PATCH 5/5] set other default value for preg_splitt() method --- src/Adapter/PhpcrOdmAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Adapter/PhpcrOdmAdapter.php b/src/Adapter/PhpcrOdmAdapter.php index 2432e3f..9a71bad 100644 --- a/src/Adapter/PhpcrOdmAdapter.php +++ b/src/Adapter/PhpcrOdmAdapter.php @@ -126,7 +126,7 @@ public function createAutoRoute(UriContext $uriContext, $locale) $basePath )); } - $segments = preg_split('#/#', $uriContext->getUri(), null, PREG_SPLIT_NO_EMPTY); + $segments = preg_split('#/#', $uriContext->getUri(), -1, PREG_SPLIT_NO_EMPTY); $headName = array_pop($segments); foreach ($segments as $segment) { $basePath .= '/'.$segment;