From cada13b6984739c269ba3140c3a92c29fab32978 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Tue, 29 Jan 2019 06:30:17 +0100 Subject: [PATCH 1/7] DevKit updates --- .travis.yml | 25 +++++++++---------- Makefile | 3 +-- README.md | 49 +++++++++++++++++++++----------------- composer.json | 8 +++---- src/Resources/meta/LICENSE | 2 +- 5 files changed, 44 insertions(+), 43 deletions(-) diff --git a/.travis.yml b/.travis.yml index e708382f..6df1aa11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,28 +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" - KERNEL_CLASS=Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel - - SYMFONY_PHPUNIT_VERSION=5.7 - - TEST_INSTALLATION=false + - 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: 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: - - env: TEST_INSTALLATION=true before_install: - phpenv config-rm xdebug.ini || true diff --git a/Makefile b/Makefile index 7f704287..7f472719 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 5a532f0c..4368f60b 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,13 @@ [![Monthly Downloads](https://poser.pugx.org/symfony-cmf/menu-bundle/d/monthly)](https://packagist.org/packages/symfony-cmf/menu-bundle) [![Daily Downloads](https://poser.pugx.org/symfony-cmf/menu-bundle/d/daily)](https://packagist.org/packages/symfony-cmf/menu-bundle) -Branch | Travis | Coveralls | ------- | ------ | --------- | -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 + +This package is part of the [Symfony Content Management Framework (CMF)](https://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. @@ -20,24 +22,24 @@ The MenuBundle provides menus from a doctrine object manager with the help of Kn ## 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/menu-bundle Documentation](http://symfony.com/doc/master/cmf/bundles/menu/index.html) +* [symfony-cmf/menu-bundle Documentation](https://symfony.com/doc/master/cmf/bundles/menu/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/menu-bundle.svg?branch=master -[travis_stable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=master -[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=master -[travis_link]: https://travis-ci.org/symfony-cmf/menu-bundle - -[coveralls_legacy_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=master -[coveralls_legacy_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=master -[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=master -[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=master -[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=master -[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=master +[travis_stable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=3.0-dev +[travis_stable_link]: https://travis-ci.org/symfony-cmf/menu-bundle +[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=3.0-dev +[travis_unstable_link]: https://travis-ci.org/symfony-cmf/menu-bundle + +[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=3.0-dev +[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=3.0-dev +[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=3.0-dev +[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=3.0-dev + +[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/badges/quality-score.png?b=3.0-dev +[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/?branch=3.0-dev +[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/badges/quality-score.png?b=3.0-dev +[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/?branch=3.0-dev diff --git a/composer.json b/composer.json index 5c16ea5f..e34db27c 100644 --- a/composer.json +++ b/composer.json @@ -15,15 +15,15 @@ } ], "require": { - "php": "^7.1", - "symfony/framework-bundle": "^2.8 || ^3.3 || ^4.0", - "symfony/validator": "^2.8 || ^3.3 || ^4.0", + "php": "^7.2", + "symfony/framework-bundle": "^3.4 || ^4.0", + "symfony/validator": "^3.4 || ^4.0", "knplabs/knp-menu-bundle": "^2.2.0", "knplabs/knp-menu": "^2.0.0" }, "require-dev": { "symfony/monolog-bundle": "~3.1", - "symfony/phpunit-bridge": "^3.3 || ^4.0", + "symfony/phpunit-bridge": "^3.4 || ^4.0", "symfony-cmf/routing-bundle": "^1.4 || ^2.0", "symfony-cmf/testing": "^2.1.8", "twig/twig": "^1.35 || ^2.4.4", diff --git a/src/Resources/meta/LICENSE b/src/Resources/meta/LICENSE index 2bc0b528..61229a1e 100644 --- a/src/Resources/meta/LICENSE +++ b/src/Resources/meta/LICENSE @@ -1,4 +1,4 @@ -Symfony Cmf Menu Bundle +Symfony CMF Menu Bundle The MIT License From a7557ee6e5cc8e167fa27290e3d1eed0b0bd695d Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 22:54:18 +0100 Subject: [PATCH 2/7] DevKit updates --- .travis.yml | 29 +++++++++++++++++------------ Makefile | 2 +- README.md | 26 +++++++++++++------------- composer.json | 4 ++-- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6df1aa11..c7e0e1de 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,27 @@ 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\MenuBundle\Tests\Fixtures\App\Kernel - - SYMFONY_PHPUNIT_VERSION=5.7.26 + - SYMFONY_PHPUNIT_VERSION=7 + - TEST_INSTALLATION=false matrix: include: - - 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.*" + - 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.* 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 7f472719..c41febcc 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ ifdef BRANCH VERSION=dev-${BRANCH} endif PACKAGE=symfony-cmf/menu-bundle -export KERNEL_CLASS=Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel + list: @echo 'test: will run all tests' @echo 'unit_tests: will run unit tests only' diff --git a/README.md b/README.md index 4368f60b..225ba36c 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ 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] | +2.2 | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_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 @@ The MenuBundle provides menus from a doctrine object manager with the help of Kn ## 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) @@ -58,17 +58,17 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -[travis_stable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=3.0-dev +[travis_stable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=2.2 [travis_stable_link]: https://travis-ci.org/symfony-cmf/menu-bundle -[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=3.0-dev +[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/menu-bundle.svg?branch=dev-master [travis_unstable_link]: https://travis-ci.org/symfony-cmf/menu-bundle -[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=3.0-dev -[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=3.0-dev -[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=3.0-dev -[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=3.0-dev +[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=2.2 +[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=2.2 +[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/menu-bundle/badge.svg?branch=dev-master +[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/menu-bundle?branch=dev-master -[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/badges/quality-score.png?b=3.0-dev -[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/?branch=3.0-dev -[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/badges/quality-score.png?b=3.0-dev -[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/?branch=3.0-dev +[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/badges/quality-score.png?b=2.2 +[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/?branch=2.2 +[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/badges/quality-score.png?b=dev-master +[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/menu-bundle/?branch=dev-master diff --git a/composer.json b/composer.json index e34db27c..feae914c 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.1", "symfony/framework-bundle": "^3.4 || ^4.0", "symfony/validator": "^3.4 || ^4.0", "knplabs/knp-menu-bundle": "^2.2.0", @@ -23,7 +23,7 @@ }, "require-dev": { "symfony/monolog-bundle": "~3.1", - "symfony/phpunit-bridge": "^3.4 || ^4.0", + "symfony/phpunit-bridge": "^4.2.2", "symfony-cmf/routing-bundle": "^1.4 || ^2.0", "symfony-cmf/testing": "^2.1.8", "twig/twig": "^1.35 || ^2.4.4", From 05b850b453f71b3c3a5db8d335a777ac1bfb38c2 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Wed, 30 Jan 2019 23:42:18 +0100 Subject: [PATCH 3/7] DevKit updates --- .travis.yml | 2 +- Makefile | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c7e0e1de..5b2bf92f 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: diff --git a/Makefile b/Makefile index c41febcc..e89a11ec 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 2e7dd5fd70e88baaab083e22f432254d297280d0 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 1 Mar 2019 15:53:37 +0100 Subject: [PATCH 4/7] DevKit updates --- .php_cs.dist | 64 +++++++++++++++++++++++++++++++++++ .styleci.yml | 2 +- .travis.yml | 25 ++++++++------ .travis/after_success_test.sh | 5 +++ .travis/install_lint.sh | 11 ++++++ .travis/install_test.sh | 19 +++++++++++ Makefile | 58 +++++++++++++++++++++++++------ README.md | 2 +- composer.json | 4 +-- phpunit.xml.dist | 40 +++++++++++++--------- src/Resources/meta/LICENSE | 2 +- 11 files changed, 191 insertions(+), 41 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 00000000..5759af56 --- /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 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 5b2bf92f..bd28a5c0 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,21 +29,22 @@ 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.* fast_finish: true @@ -59,9 +60,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 00000000..98374202 --- /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 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 e89a11ec..3b6f995c 100644 --- a/Makefile +++ b/Makefile @@ -7,33 +7,71 @@ ############################################################################ # 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/menu-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' - -include ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk -include ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk +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 .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 225ba36c..6008e22f 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ The MenuBundle provides menus from a doctrine object manager with the help of Kn ## 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 feae914c..62c11d9d 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ ], "require": { "php": "^7.1", - "symfony/framework-bundle": "^3.4 || ^4.0", - "symfony/validator": "^3.4 || ^4.0", + "symfony/framework-bundle": "^3.4 || ^4.1", + "symfony/validator": "^3.4 || ^4.1", "knplabs/knp-menu-bundle": "^2.2.0", "knplabs/knp-menu": "^2.0.0" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b6e6e63a..35361c27 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,27 +2,35 @@ + colors="true" + bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php" +> - - + + + + ./tests/Unit - + ./tests/Functional + ./tests/Functional/Doctrine/Orm - + + + + + + src/ + + Resources/ + + + + + - - - src - - *Bundle.php - Resources/ - - - + + diff --git a/src/Resources/meta/LICENSE b/src/Resources/meta/LICENSE index 61229a1e..0041ef75 100644 --- a/src/Resources/meta/LICENSE +++ b/src/Resources/meta/LICENSE @@ -2,7 +2,7 @@ Symfony CMF Menu 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 f46063ab04afc24f9133bc29e06456aa298bed41 Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Fri, 1 Mar 2019 23:45:19 +0100 Subject: [PATCH 5/7] cs fixes for php and its strictness --- .gitignore | 2 ++ composer.json | 2 +- src/CmfMenuBundle.php | 4 ++- src/DependencyInjection/CmfMenuExtension.php | 6 ++-- .../Compiler/DecorateMenuFactoryPass.php | 4 ++- .../Compiler/ValidationPass.php | 4 ++- src/DependencyInjection/Configuration.php | 4 ++- src/Doctrine/Phpcr/Menu.php | 4 ++- src/Doctrine/Phpcr/MenuNode.php | 4 ++- src/Doctrine/Phpcr/MenuNodeBase.php | 4 ++- src/Event/CreateMenuItemFromNodeEvent.php | 4 ++- src/Event/Events.php | 6 ++-- src/Extension/ContentExtension.php | 8 +++-- src/Loader/VotingNodeLoader.php | 6 ++-- src/Model/Menu.php | 4 ++- src/Model/MenuNode.php | 11 +++--- src/Model/MenuNodeBase.php | 4 ++- src/Model/MenuNodeReferrersInterface.php | 4 ++- src/Model/MenuOptionsInterface.php | 4 ++- src/Provider/PhpcrMenuProvider.php | 36 ++++++++++--------- .../CreateMenuItemFromNodeListener.php | 4 ++- .../Voter/MenuContentVoter.php | 6 ++-- src/QuietFactory.php | 6 ++-- src/Voter/RequestContentIdentityVoter.php | 4 ++- .../RequestParentContentIdentityVoter.php | 4 ++- src/Voter/UriPrefixVoter.php | 6 ++-- .../Doctrine/Phpcr/MenuNodeTest.php | 13 +++---- tests/Functional/Doctrine/Phpcr/MenuTest.php | 7 ++-- tests/Functional/RenderingTest.php | 4 ++- .../DependencyInjection/XmlSchemaTest.php | 4 ++- tests/Unit/Extension/ContentExtensionTest.php | 22 ++++++------ tests/Unit/Loader/VotingNodeLoaderTest.php | 14 ++++---- tests/Unit/Model/MenuNodeTest.php | 6 ++-- tests/Unit/Provider/PhpcrMenuProviderTest.php | 6 ++-- .../Voter/MenuContentVoterTest.php | 12 ++++--- tests/Unit/QuietFactoryTest.php | 6 ++-- .../LegacyRequestContentIdentityVoterTest.php | 18 +++++----- .../Voter/RequestContentIdentityVoterTest.php | 18 +++++----- .../RequestContentIdentityVoterTestCase.php | 10 +++--- .../RequestParentContentIdentityVoterTest.php | 6 ++-- tests/Unit/Voter/UriPrefixVoterTest.php | 6 ++-- 41 files changed, 190 insertions(+), 117 deletions(-) diff --git a/.gitignore b/.gitignore index f283645b..ded3d232 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 62c11d9d..55d43957 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "knplabs/knp-menu": "^2.0.0" }, "require-dev": { - "symfony/monolog-bundle": "~3.1", + "symfony/monolog-bundle": "^3.1", "symfony/phpunit-bridge": "^4.2.2", "symfony-cmf/routing-bundle": "^1.4 || ^2.0", "symfony-cmf/testing": "^2.1.8", diff --git a/src/CmfMenuBundle.php b/src/CmfMenuBundle.php index 7712ad1a..3e989882 100644 --- a/src/CmfMenuBundle.php +++ b/src/CmfMenuBundle.php @@ -1,9 +1,11 @@ removeDefinition('cmf_menu.current_item_voter.content_identity'); } - if (isset($config['voters']) && !array_key_exists('uri_prefix', $config['voters'])) { + if (isset($config['voters']) && !\array_key_exists('uri_prefix', $config['voters'])) { $container->removeDefinition('cmf_menu.current_item_voter.uri_prefix'); } } diff --git a/src/DependencyInjection/Compiler/DecorateMenuFactoryPass.php b/src/DependencyInjection/Compiler/DecorateMenuFactoryPass.php index d56e3316..97dd5f80 100644 --- a/src/DependencyInjection/Compiler/DecorateMenuFactoryPass.php +++ b/src/DependencyInjection/Compiler/DecorateMenuFactoryPass.php @@ -1,9 +1,11 @@ contentRouter->generate( $options['content'], - isset($options['routeParameters']) ? $options['routeParameters'] : [], + $options['routeParameters'] ?? [], (isset($options['routeAbsolute']) && $options['routeAbsolute']) ? UrlGeneratorInterface::ABSOLUTE_URL : UrlGeneratorInterface::ABSOLUTE_PATH ); } @@ -125,7 +127,7 @@ private function determineLinkType(array $options) private function validateLinkType($linkType) { $linkTypes = ['uri', 'route', 'content']; - if (!in_array($linkType, $linkTypes)) { + if (!\in_array($linkType, $linkTypes, true)) { throw new \InvalidArgumentException(sprintf( 'Invalid link type "%s", expected: "%s"', $linkType, diff --git a/src/Loader/VotingNodeLoader.php b/src/Loader/VotingNodeLoader.php index b5fcb67c..3d7f9512 100644 --- a/src/Loader/VotingNodeLoader.php +++ b/src/Loader/VotingNodeLoader.php @@ -1,9 +1,11 @@ supports($data)) { throw new \InvalidArgumentException(sprintf( 'NodeLoader can only handle data implementing NodeInterface, "%s" given.', - is_object($data) ? get_class($data) : gettype($data) + \is_object($data) ? \get_class($data) : \gettype($data) )); } $event = new CreateMenuItemFromNodeEvent($data); diff --git a/src/Model/Menu.php b/src/Model/Menu.php index 8344bcc3..01701e06 100644 --- a/src/Model/Menu.php +++ b/src/Model/Menu.php @@ -1,9 +1,11 @@ find($name, false) instanceof NodeInterface; } + /** + * Get the object manager named $managerName from the registry. + * + * @return DocumentManager + */ + protected function getObjectManager() + { + return $this->managerRegistry->getManager($this->managerName); + } + /** * @param string $name Name of the menu to load * @param bool $throw Whether to throw an exception if the menu is not * found or no valid menu. Returns false if $throw is * false and there is no menu at $name * - * @return object|bool The menu root found with $name or false if $throw - * is false and the menu was not found - * * @throws \InvalidArgumentException Only if $throw is true throws this * exception if the name is empty or no menu found + * + * @return object|bool The menu root found with $name or false if $throw + * is false and the menu was not found */ private function find($name, $throw) { @@ -208,7 +220,7 @@ private function find($name, $throw) if ($this->getPrefetch() > 0) { if ($session instanceof Session && 0 < $session->getSessionOption(Session::OPTION_FETCH_DEPTH) - && 0 === strncmp($path, $this->getMenuRoot(), strlen($this->getMenuRoot())) + && 0 === strncmp($path, $this->getMenuRoot(), \strlen($this->getMenuRoot())) ) { // we have jackalope with a fetch depth. prefetch all menu // nodes of all menues. @@ -255,14 +267,4 @@ private function find($name, $throw) return $menu; } - - /** - * Get the object manager named $managerName from the registry. - * - * @return DocumentManager - */ - protected function getObjectManager() - { - return $this->managerRegistry->getManager($this->managerName); - } } diff --git a/src/PublishWorkflow/CreateMenuItemFromNodeListener.php b/src/PublishWorkflow/CreateMenuItemFromNodeListener.php index a763fd18..c136a4e7 100644 --- a/src/PublishWorkflow/CreateMenuItemFromNodeListener.php +++ b/src/PublishWorkflow/CreateMenuItemFromNodeListener.php @@ -1,9 +1,11 @@ supportsClass(get_class($object))) { + if (!$this->supportsClass(\get_class($object))) { return self::ACCESS_ABSTAIN; } /** @var PublishWorkflowChecker $publishWorkflowChecker */ diff --git a/src/QuietFactory.php b/src/QuietFactory.php index a37b6ed2..1bccd16d 100644 --- a/src/QuietFactory.php +++ b/src/QuietFactory.php @@ -1,9 +1,11 @@ innerFactory, 'addExtension')) { throw new LogicException(sprintf( 'Wrapped factory "%s" does not have the method "addExtension".', - get_class($this->innerFactory) + \get_class($this->innerFactory) )); } $this->innerFactory->addExtension($extension, $priority); diff --git a/src/Voter/RequestContentIdentityVoter.php b/src/Voter/RequestContentIdentityVoter.php index b6fd6876..3139de02 100644 --- a/src/Voter/RequestContentIdentityVoter.php +++ b/src/Voter/RequestContentIdentityVoter.php @@ -1,9 +1,11 @@ hasOption('currentUriPrefix')) { $currentUriPrefix = $content->getOption('currentUriPrefix'); $currentUriPrefix = str_replace('{_locale}', $request->getLocale(), $currentUriPrefix); - if (0 === strncmp($request->getPathInfo(), $currentUriPrefix, strlen($currentUriPrefix))) { + if (0 === strncmp($request->getPathInfo(), $currentUriPrefix, \strlen($currentUriPrefix))) { return true; } } diff --git a/tests/Functional/Doctrine/Phpcr/MenuNodeTest.php b/tests/Functional/Doctrine/Phpcr/MenuNodeTest.php index 55bc0caa..d8e0538e 100644 --- a/tests/Functional/Doctrine/Phpcr/MenuNodeTest.php +++ b/tests/Functional/Doctrine/Phpcr/MenuNodeTest.php @@ -1,9 +1,11 @@ setAccessible(true); $v = $prop->getValue($menuNode); - if (!is_object($value)) { + if (!\is_object($value)) { $this->assertEquals($value, $v); } } @@ -162,12 +164,11 @@ public function testMenuNode() $this->assertCount(0, $menuNode->getChildren()); } - /** - * @expectedException \Doctrine\ODM\PHPCR\Exception\OutOfBoundsException - * @expectedExceptionMessage Allowed child classes "Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode" - */ public function testPersistInvalidChild() { + $this->expectException(\Doctrine\ODM\PHPCR\Exception\OutOfBoundsException::class); + $this->expectExceptionMessage('Allowed child classes "Symfony\\Cmf\\Bundle\\MenuBundle\\Doctrine\\Phpcr\\MenuNode"'); + $menuNode = new MenuNode(); $menuNode->setName('menu-node'); $menuNode->setParentDocument($this->rootDocument); diff --git a/tests/Functional/Doctrine/Phpcr/MenuTest.php b/tests/Functional/Doctrine/Phpcr/MenuTest.php index 953b6a0e..17d8b945 100644 --- a/tests/Functional/Doctrine/Phpcr/MenuTest.php +++ b/tests/Functional/Doctrine/Phpcr/MenuTest.php @@ -1,9 +1,11 @@ expectException(\Doctrine\ODM\PHPCR\Exception\OutOfBoundsException::class); + $menu = new Menu(); $menu->setPosition($this->rootDocument, 'main'); $this->dm->persist($menu); diff --git a/tests/Functional/RenderingTest.php b/tests/Functional/RenderingTest.php index c0516f26..3f6c9ae2 100644 --- a/tests/Functional/RenderingTest.php +++ b/tests/Functional/RenderingTest.php @@ -1,9 +1,11 @@ generator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface'); + $this->generator = $this->createMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface'); $this->subject = new ContentExtension($this->generator); } @@ -119,21 +121,19 @@ public function testOptionsAsRemovedWhenLinkTypeIsElse() ); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid link type - */ public function testFailsOnInvalidLinkType() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid link type'); + $this->subject->buildOptions(['linkType' => 'not_valid']); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage could not find content option - */ public function testFailsWhenContentIsNotAvailable() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('could not find content option'); + $this->subject->buildOptions(['linkType' => 'content']); } } diff --git a/tests/Unit/Loader/VotingNodeLoaderTest.php b/tests/Unit/Loader/VotingNodeLoaderTest.php index 41f4fb7f..ef09ebcb 100644 --- a/tests/Unit/Loader/VotingNodeLoaderTest.php +++ b/tests/Unit/Loader/VotingNodeLoaderTest.php @@ -1,9 +1,11 @@ factory = $this->getMock('Knp\Menu\FactoryInterface'); - $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $this->factory = $this->createMock('Knp\Menu\FactoryInterface'); + $this->dispatcher = $this->createMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); $this->subject = new VotingNodeLoader($this->factory, $this->dispatcher); } @@ -57,7 +59,7 @@ public function testCreateFromNode($options) $that = $this; $this->factory->expects($this->exactly($nodes))->method('createItem')->will($this->returnCallback(function () use ($that) { - return $that->getMock('Knp\Menu\ItemInterface'); + return $that->createMock('Knp\Menu\ItemInterface'); })); // test @@ -78,7 +80,7 @@ public function getCreateFromNodeData() protected function getNode($name, $options = [], $children = []) { - $node = $this->getMock('Knp\Menu\NodeInterface'); + $node = $this->createMock('Knp\Menu\NodeInterface'); $node->expects($this->any())->method('getName')->willReturn($name); $node->expects($this->any())->method('getOptions')->willReturn($options); diff --git a/tests/Unit/Model/MenuNodeTest.php b/tests/Unit/Model/MenuNodeTest.php index 1f6916f7..43540e6a 100644 --- a/tests/Unit/Model/MenuNodeTest.php +++ b/tests/Unit/Model/MenuNodeTest.php @@ -1,9 +1,11 @@ pwfc = $this->getMockBuilder('Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowChecker') ->disableOriginalConstructor() ->getMock(); - $this->container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $this->container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $this->container ->expects($this->any()) ->method('get') @@ -57,7 +59,7 @@ public function setUp() public function providePublishWorkflowChecker() { - $content = $this->getMock('Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableReadInterface'); + $content = $this->createMock('Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableReadInterface'); return [ [ @@ -142,7 +144,7 @@ public function providePublishWorkflowChecker() public function testPublishWorkflowChecker($expected, $attributes, $content, $isMenuPusblishable, $isContentPublishable) { $attributes = (array) $attributes; - $menuNode = $this->getMock('Symfony\Cmf\Bundle\MenuBundle\Model\MenuNode'); + $menuNode = $this->createMock('Symfony\Cmf\Bundle\MenuBundle\Model\MenuNode'); $menuNode->expects($this->any()) ->method('getContent') ->will($this->returnValue($content)) diff --git a/tests/Unit/QuietFactoryTest.php b/tests/Unit/QuietFactoryTest.php index c151bfbe..67c7b6eb 100644 --- a/tests/Unit/QuietFactoryTest.php +++ b/tests/Unit/QuietFactoryTest.php @@ -1,9 +1,11 @@ setRequest($request); + $this->voter->setRequest(null); - return $voter; + $this->assertNull($this->voter->matchItem($this->createItem())); } - public function testSkipsWhenNoRequestIsAvailable() + protected function buildVoter(Request $request) { - $this->voter->setRequest(null); + $voter = new RequestContentIdentityVoter('_content'); + $voter->setRequest($request); - $this->assertNull($this->voter->matchItem($this->createItem())); + return $voter; } } diff --git a/tests/Unit/Voter/RequestContentIdentityVoterTest.php b/tests/Unit/Voter/RequestContentIdentityVoterTest.php index bc2f5ce0..841fa0c1 100644 --- a/tests/Unit/Voter/RequestContentIdentityVoterTest.php +++ b/tests/Unit/Voter/RequestContentIdentityVoterTest.php @@ -1,9 +1,11 @@ push($request); + $voter = new RequestContentIdentityVoter('_content', new RequestStack()); - return new RequestContentIdentityVoter('_content', $requestStack); + $this->assertNull($voter->matchItem($this->createItem())); } - public function testSkipsWhenNoRequestIsAvailable() + protected function buildVoter(Request $request) { - $voter = new RequestContentIdentityVoter('_content', new RequestStack()); + $requestStack = new RequestStack(); + $requestStack->push($request); - $this->assertNull($voter->matchItem($this->createItem())); + return new RequestContentIdentityVoter('_content', $requestStack); } } diff --git a/tests/Unit/Voter/RequestContentIdentityVoterTestCase.php b/tests/Unit/Voter/RequestContentIdentityVoterTestCase.php index c0379809..83d76941 100644 --- a/tests/Unit/Voter/RequestContentIdentityVoterTestCase.php +++ b/tests/Unit/Voter/RequestContentIdentityVoterTestCase.php @@ -1,9 +1,11 @@ voter = $this->buildVoter($this->request->reveal()); } - abstract protected function buildVoter(Request $request); - abstract public function testSkipsWhenNoRequestIsAvailable(); public function testSkipsWhenNoContentIsAvailable() @@ -75,6 +75,8 @@ public function testSkipsWhenContentIsNotEqual() $this->assertNull($this->voter->matchItem($this->createItem(new \stdClass()))); } + abstract protected function buildVoter(Request $request); + protected function createItem($content = null) { $item = $this->prophesize(ItemInterface::class); diff --git a/tests/Unit/Voter/RequestParentContentIdentityVoterTest.php b/tests/Unit/Voter/RequestParentContentIdentityVoterTest.php index 5ce5e4ce..b11e0633 100644 --- a/tests/Unit/Voter/RequestParentContentIdentityVoterTest.php +++ b/tests/Unit/Voter/RequestParentContentIdentityVoterTest.php @@ -1,9 +1,11 @@ Date: Sat, 2 Mar 2019 00:00:34 +0100 Subject: [PATCH 6/7] DevKit updates --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 55d43957..62c11d9d 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "knplabs/knp-menu": "^2.0.0" }, "require-dev": { - "symfony/monolog-bundle": "^3.1", + "symfony/monolog-bundle": "~3.1", "symfony/phpunit-bridge": "^4.2.2", "symfony-cmf/routing-bundle": "^1.4 || ^2.0", "symfony-cmf/testing": "^2.1.8", From 6c99e3ca8521169aad04f294ed3dab323f1b383b Mon Sep 17 00:00:00 2001 From: electricmaxxx Date: Sat, 2 Mar 2019 00:01:46 +0100 Subject: [PATCH 7/7] DevKit updates --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 62c11d9d..55d43957 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "knplabs/knp-menu": "^2.0.0" }, "require-dev": { - "symfony/monolog-bundle": "~3.1", + "symfony/monolog-bundle": "^3.1", "symfony/phpunit-bridge": "^4.2.2", "symfony-cmf/routing-bundle": "^1.4 || ^2.0", "symfony-cmf/testing": "^2.1.8",