From bbc7bd46fdfecbbf034bcdc624d3e76e73718ab5 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Wed, 15 Nov 2017 18:18:49 -0500 Subject: [PATCH 1/5] we move to 4.0 constraints --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 1659cceb..1b2357f8 100644 --- a/composer.json +++ b/composer.json @@ -24,23 +24,23 @@ ], "require": { "php": "^5.4|^7.0", - "symfony/framework-bundle": "~2.3|~3.0", + "symfony/framework-bundle": "~2.3|~3.0|^4.0", "zendframework/zenddiagnostics": "^1.0.2" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^0.7.4", "sensiolabs/security-checker": "~1.3|~2.0|~3.0|~4.0", "guzzlehttp/guzzle": "~3.8|~4.0|~5.0|~6.0", - "symfony/expression-language": "~2.3|~3.0", + "symfony/expression-language": "~2.3|~3.0|^4.0", "swiftmailer/swiftmailer": "~5.4", "doctrine/migrations": "~1.0", "doctrine/doctrine-migrations-bundle": "~1.0", - "symfony/twig-bundle": "^2.0|^3.0", - "symfony/browser-kit": "^2.0|^3.0", - "symfony/asset": "^2.0|^3.0", - "symfony/templating": "^2.0|^3.0", + "symfony/twig-bundle": "^2.0|^3.0|^4.0", + "symfony/browser-kit": "^2.0|^3.0|^4.0", + "symfony/asset": "^2.0|^3.0|^4.0", + "symfony/templating": "^2.0|^3.0|^4.0", "phpunit/phpunit": "^4.8|^5.0", - "symfony/finder": "^2.0|^3.0" + "symfony/finder": "^2.0|^3.0|^4.0" }, "suggest": { "sensio/distribution-bundle": "To be able to use the composer ScriptHandler", From 870a06b36e3b922147a1c2c05efe7b8d09355916 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Thu, 16 Nov 2017 08:32:30 -0500 Subject: [PATCH 2/5] adding travis --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index c345f3be..9af5bcb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,10 @@ matrix: env: SYMFONY_VERSION=3.1 - php: 5.6 env: SYMFONY_VERSION=3.2 + - php: 5.6 + env: SYMFONY_VERSION=^3.3 + - php: 7.1 + env: SYMFONY_VERSION=^4.0 - php: 5.4 env: SYMFONY_VERSION=2.3;COMPOSER_FLAGS="--prefer-lowest" From 2c789c43f8b128fe69c717d14a9a8c6011aa7269 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Thu, 16 Nov 2017 08:52:46 -0500 Subject: [PATCH 3/5] adding especial for 4.0 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9af5bcb3..7c226eb7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,7 @@ matrix: before_install: - if [[ $TRAVIS_PHP_VERSION != '7.0' && $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-rm xdebug.ini; fi - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi + - if [ "$SYMFONY_VERSION" = "^4.0" ]; then composer config minimum-stability dev; composer config prefer-stable true; fi - if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony=$SYMFONY_VERSION; fi install: composer update --prefer-source $COMPOSER_FLAGS From 19c1571bb59b01965d446a64d5d2b721f2f61b39 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Fri, 1 Dec 2017 09:08:56 +0100 Subject: [PATCH 4/5] ensure we have symfony4 compatible deps --- .travis.yml | 1 - composer.json | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c226eb7..9af5bcb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,6 @@ matrix: before_install: - if [[ $TRAVIS_PHP_VERSION != '7.0' && $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-rm xdebug.ini; fi - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi - - if [ "$SYMFONY_VERSION" = "^4.0" ]; then composer config minimum-stability dev; composer config prefer-stable true; fi - if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony=$SYMFONY_VERSION; fi install: composer update --prefer-source $COMPOSER_FLAGS diff --git a/composer.json b/composer.json index 1b2357f8..f3b61f5f 100644 --- a/composer.json +++ b/composer.json @@ -22,13 +22,15 @@ "homepage": "https://github.com/liip/LiipMonitorBundle/contributors" } ], + "minimum-stability": "dev", + "prefer-stable": true, "require": { "php": "^5.4|^7.0", "symfony/framework-bundle": "~2.3|~3.0|^4.0", "zendframework/zenddiagnostics": "^1.0.2" }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "^0.7.4", + "matthiasnoback/symfony-dependency-injection-test": "^1.0|^2.0", "sensiolabs/security-checker": "~1.3|~2.0|~3.0|~4.0", "guzzlehttp/guzzle": "~3.8|~4.0|~5.0|~6.0", "symfony/expression-language": "~2.3|~3.0|^4.0", From 3521f6e7e2deecf05d8d8cfde417de017c23c0e2 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Fri, 1 Dec 2017 13:41:42 +0100 Subject: [PATCH 5/5] Symfony4 compatibility fixes --- .travis.yml | 9 +++------ DependencyInjection/LiipMonitorExtension.php | 12 ++++++++++++ Helper/PathHelper.php | 16 +++------------- Resources/config/controller.xml | 4 ---- Resources/config/helper.xml | 5 +++++ Tests/Helper/PathHelperTest.php | 19 +++++++++++-------- Tests/app/AppKernel.php | 1 + Tests/app/config_symfony2.yml | 6 ++++-- Tests/app/config_symfony3.yml | 3 +++ ...nfig_symfony27.yml => config_symfony4.yml} | 6 +++++- Tests/app/services.yml | 4 ++++ composer.json | 9 +++++---- 12 files changed, 56 insertions(+), 38 deletions(-) rename Tests/app/{config_symfony27.yml => config_symfony4.yml} (64%) create mode 100644 Tests/app/services.yml diff --git a/.travis.yml b/.travis.yml index 9af5bcb3..bce42b48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,12 +3,9 @@ sudo: required dist: trusty group: edge php: - - 5.4 - - 5.5 - 5.6 - 7.0 - 7.1 - - hhvm cache: directories: @@ -19,8 +16,6 @@ env: matrix: include: - - php: 5.6 - env: SYMFONY_VERSION=2.3 - php: 5.6 env: SYMFONY_VERSION=2.8 - php: 5.6 @@ -31,10 +26,12 @@ matrix: env: SYMFONY_VERSION=3.2 - php: 5.6 env: SYMFONY_VERSION=^3.3 + - php: 5.6 + env: SYMFONY_VERSION=^3.4 - php: 7.1 env: SYMFONY_VERSION=^4.0 - php: 5.4 - env: SYMFONY_VERSION=2.3;COMPOSER_FLAGS="--prefer-lowest" + env: SYMFONY_VERSION=2.7;COMPOSER_FLAGS="--prefer-lowest" before_install: - if [[ $TRAVIS_PHP_VERSION != '7.0' && $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-rm xdebug.ini; fi diff --git a/DependencyInjection/LiipMonitorExtension.php b/DependencyInjection/LiipMonitorExtension.php index d8e84a14..5aa3c960 100644 --- a/DependencyInjection/LiipMonitorExtension.php +++ b/DependencyInjection/LiipMonitorExtension.php @@ -49,6 +49,18 @@ public function load(array $configs, ContainerBuilder $container) $container->setParameter(sprintf('%s.default_group', $this->getAlias()), $config['default_group']); + // symfony3 does not define templating.helper.assets unless php templating is included + if ($container->has('templating.helper.assets')) { + $pathHelper = $container->getDefinition('liip_monitor.helper'); + $pathHelper->replaceArgument(0, 'templating.helper.assets'); + } + + // symfony3 does not define templating.helper.router unless php templating is included + if ($container->has('templating.helper.router')) { + $pathHelper = $container->getDefinition('liip_monitor.helper'); + $pathHelper->replaceArgument(1, 'templating.helper.router'); + } + if (empty($config['checks'])) { return; } diff --git a/Helper/PathHelper.php b/Helper/PathHelper.php index 9351b199..4063a02e 100644 --- a/Helper/PathHelper.php +++ b/Helper/PathHelper.php @@ -2,25 +2,15 @@ namespace Liip\MonitorBundle\Helper; -use Symfony\Component\DependencyInjection\ContainerInterface; - class PathHelper { protected $assetsHelper; protected $routerHelper; - /** - * @param ContainerInterface $container - */ - public function __construct(ContainerInterface $container) + public function __construct($assetsHelper, $routerHelper) { - // symfony3 does not define templating.helper.assets unless php templating is included - $this->assetsHelper = $container->has('templating.helper.assets') ? - $container->get('templating.helper.assets') : $container->get('assets.packages'); - - // symfony3 does not define templating.helper.router unless php templating is included - $this->routerHelper = $container->has('templating.helper.router') ? - $container->get('templating.helper.router') : $container->get('router'); + $this->assetsHelper = $assetsHelper; + $this->routerHelper = $routerHelper; } /** diff --git a/Resources/config/controller.xml b/Resources/config/controller.xml index 541d2e16..a6552abd 100644 --- a/Resources/config/controller.xml +++ b/Resources/config/controller.xml @@ -6,13 +6,9 @@ Liip\MonitorBundle\Controller\HealthCheckController - Liip\MonitorBundle\Helper\PathHelper - - - diff --git a/Resources/config/helper.xml b/Resources/config/helper.xml index 434fced1..f84c6e24 100644 --- a/Resources/config/helper.xml +++ b/Resources/config/helper.xml @@ -8,9 +8,14 @@ Liip\MonitorBundle\Helper\RawConsoleReporter Liip\MonitorBundle\Helper\ConsoleReporter Liip\MonitorBundle\Helper\RunnerManager + Liip\MonitorBundle\Helper\PathHelper + + + + diff --git a/Tests/Helper/PathHelperTest.php b/Tests/Helper/PathHelperTest.php index 0879e07c..dc53177b 100644 --- a/Tests/Helper/PathHelperTest.php +++ b/Tests/Helper/PathHelperTest.php @@ -1,4 +1,5 @@ $environment)); - $container = $client->getContainer(); + $container = $client->getKernel()->getContainer(); - $pathHelper = new PathHelper($container); + $pathHelper = $container->get('path_helper'); // test route is defined in Tests/app/routing.yml $routes = $pathHelper->generateRoutes(['test_route' => []]); diff --git a/Tests/app/AppKernel.php b/Tests/app/AppKernel.php index 7119669e..18b68e09 100644 --- a/Tests/app/AppKernel.php +++ b/Tests/app/AppKernel.php @@ -16,6 +16,7 @@ public function registerBundles() return [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), + new Liip\MonitorBundle\LiipMonitorBundle(), ]; } diff --git a/Tests/app/config_symfony2.yml b/Tests/app/config_symfony2.yml index b51e1ad2..aa2ebe52 100644 --- a/Tests/app/config_symfony2.yml +++ b/Tests/app/config_symfony2.yml @@ -1,11 +1,13 @@ -# symfony 2 config (requires assets_base_urls for testing) +imports: + - { resource: services.yml } + +# symfony 2.7 config (no longer allows assets_base_urls) framework: router: resource: "%kernel.root_dir%/routing.yml" secret: test templating: engines: ['twig'] - assets_base_urls: { http: ["http://testurl"], ssl: ["http://testurl"] } test: ~ profiler: collect: false diff --git a/Tests/app/config_symfony3.yml b/Tests/app/config_symfony3.yml index a6dcfbbc..754d2256 100644 --- a/Tests/app/config_symfony3.yml +++ b/Tests/app/config_symfony3.yml @@ -1,3 +1,6 @@ +imports: + - { resource: services.yml } + # symfony 3 config (requires assets defined) framework: router: diff --git a/Tests/app/config_symfony27.yml b/Tests/app/config_symfony4.yml similarity index 64% rename from Tests/app/config_symfony27.yml rename to Tests/app/config_symfony4.yml index 63dfc88e..754d2256 100644 --- a/Tests/app/config_symfony27.yml +++ b/Tests/app/config_symfony4.yml @@ -1,4 +1,7 @@ -# symfony 2.7 config (no longer allows assets_base_urls) +imports: + - { resource: services.yml } + +# symfony 3 config (requires assets defined) framework: router: resource: "%kernel.root_dir%/routing.yml" @@ -6,5 +9,6 @@ framework: templating: engines: ['twig'] test: ~ + assets: ~ profiler: collect: false diff --git a/Tests/app/services.yml b/Tests/app/services.yml new file mode 100644 index 00000000..0919a946 --- /dev/null +++ b/Tests/app/services.yml @@ -0,0 +1,4 @@ +services: + path_helper: + alias: 'liip_monitor.helper' + public: true \ No newline at end of file diff --git a/composer.json b/composer.json index f3b61f5f..b6a75b39 100644 --- a/composer.json +++ b/composer.json @@ -26,11 +26,12 @@ "prefer-stable": true, "require": { "php": "^5.4|^7.0", - "symfony/framework-bundle": "~2.3|~3.0|^4.0", - "zendframework/zenddiagnostics": "^1.0.2" + "symfony/framework-bundle": "~2.7|~3.0|^4.0", + "zendframework/zenddiagnostics": "^1.0.2", + "symfony/symfony": "^4.0" }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "^1.0|^2.0", + "matthiasnoback/symfony-dependency-injection-test": "^1.0", "sensiolabs/security-checker": "~1.3|~2.0|~3.0|~4.0", "guzzlehttp/guzzle": "~3.8|~4.0|~5.0|~6.0", "symfony/expression-language": "~2.3|~3.0|^4.0", @@ -41,7 +42,7 @@ "symfony/browser-kit": "^2.0|^3.0|^4.0", "symfony/asset": "^2.0|^3.0|^4.0", "symfony/templating": "^2.0|^3.0|^4.0", - "phpunit/phpunit": "^4.8|^5.0", + "phpunit/phpunit": "^4.0|^5.0", "symfony/finder": "^2.0|^3.0|^4.0" }, "suggest": {