From e6aed007817e25eb4a8cd907ae77d03331eb0ca8 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Wed, 19 Feb 2020 22:44:04 +0100 Subject: [PATCH] Add compatibility to symfony 5 --- .gitignore | 1 + .travis.yml | 18 +++++++++++------- composer.json | 8 ++++---- features/bootstrap/FeatureContext.php | 4 ++++ testapp/behat.yml | 2 ++ .../Features/Context/FeatureContext.php | 6 +++++- 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index c46586e..e7049e4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ vendor testapp/app/cache testapp/app/logs .htaccess +/var diff --git a/.travis.yml b/.travis.yml index 95d354c..d234a68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,19 +19,23 @@ matrix: - php: 5.6 env: SYMFONY_VERSION='2.8.*' - php: 7.1 - env: SYMFONY_VERSION='3.3.*' + env: SYMFONY_VERSION='^3.4' - php: 7.1 - env: DEPS=dev SYMFONY_VERSION='3.4.*' - - php: 7.1 - env: DEVS=dev SYMFONY_VERSION='4.0.*' + env: SYMFONY_VERSION='^4.3' + - php: 7.2 + env: SYMFONY_VERSION='^4.4' + - php: 7.3 + env: SYMFONY_VERSION='5.0.*' + - php: 7.4 + env: SYMFONY_VERSION='^5.0' allow_failures: - - php: 7.1 - env: SYMFONY_VERSION='4.0.x-dev' + - php: 7.4 + env: DEPS=dev SYMFONY_VERSION='^5.0@dev' before_install: - composer self-update - mkdir -p ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d && echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - if [ "$DEPS" = 'dev' ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; + - if [ "$DEPS" != "" ]; then composer config minimum-stability $DEPS; fi; - if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"; fi; install: diff --git a/composer.json b/composer.json index c6d421e..38b68de 100644 --- a/composer.json +++ b/composer.json @@ -19,16 +19,16 @@ "require": { "php": ">=5.3.3", "behat/behat": "^3.4.3", - "symfony/framework-bundle": "~2.0|~3.0|~4.0" + "symfony/framework-bundle": "~2.0|~3.0|~4.0|~5.0" }, "require-dev": { - "symfony/symfony": "~2.1|~3.0|~4.0", + "symfony/symfony": "~2.1|~3.0|~4.0|~5.0", "behat/mink-extension": "~2.0", "behat/mink": "~1.7@dev", "behat/mink-browserkit-driver": "~1.3@dev", - "phpspec/phpspec": "~2.0|~3.0|~4.0", - "phpunit/phpunit": "~4.0|~5.0" + "phpspec/phpspec": "~2.0|~3.0|~4.0|~5.0|~6.0", + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "autoload": { diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 3491df5..cecdda4 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -5,6 +5,10 @@ use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; +if (!class_exists('PHPUnit_Framework_Assert')) { + class_alias('PHPUnit\Framework\Assert', 'PHPUnit_Framework_Assert'); +} + /** * Behat context class. */ diff --git a/testapp/behat.yml b/testapp/behat.yml index ef6da1c..64168a3 100644 --- a/testapp/behat.yml +++ b/testapp/behat.yml @@ -1,4 +1,6 @@ default: + translation: + locale: en formatters: progress: paths: false diff --git a/testapp/src/Behat/Sf2DemoBundle/Features/Context/FeatureContext.php b/testapp/src/Behat/Sf2DemoBundle/Features/Context/FeatureContext.php index 7072c9e..948132c 100644 --- a/testapp/src/Behat/Sf2DemoBundle/Features/Context/FeatureContext.php +++ b/testapp/src/Behat/Sf2DemoBundle/Features/Context/FeatureContext.php @@ -5,6 +5,10 @@ use Symfony\Component\HttpKernel\KernelInterface; use Behat\Symfony2Extension\Context\KernelAwareContext; +if (!class_exists('PHPUnit_Framework_Assert')) { + class_alias('PHPUnit\Framework\Assert', 'PHPUnit_Framework_Assert'); +} + class FeatureContext implements KernelAwareContext { private $kernel; @@ -78,7 +82,7 @@ public function theValueShouldBeAnArray() public function theArrayShouldContainOnlyTheValues($arg) { $values = explode(',', $arg); - + \PHPUnit_Framework_Assert::assertSame($values, $this->containerParameters[$this->parameterKey]); } }