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..0b46896 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -4,6 +4,12 @@ use Behat\Gherkin\Node\PyStringNode; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; +use PHPUnit\Framework\Assert; + +// BC Layer for older PHPUnit versions. +if (!class_exists('PHPUnit\Framework\Assert')) { + class_alias('PHPUnit_Framework_Assert', 'PHPUnit\Framework\Assert'); +} /** * Behat context class. @@ -82,7 +88,7 @@ public function itShouldPassWith($success, PyStringNode $text) */ public function theOutputShouldContain(PyStringNode $text) { - PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput()); + Assert::assertContains($this->getExpectedOutput($text), $this->getOutput()); } private function getExpectedOutput(PyStringNode $expectedText) @@ -125,13 +131,13 @@ public function itShouldFail($success) echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput(); } - PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode()); + Assert::assertNotEquals(0, $this->getExitCode()); } else { if (0 !== $this->getExitCode()) { echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput(); } - PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode()); + Assert::assertEquals(0, $this->getExitCode()); } } 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..e52a18d 100644 --- a/testapp/src/Behat/Sf2DemoBundle/Features/Context/FeatureContext.php +++ b/testapp/src/Behat/Sf2DemoBundle/Features/Context/FeatureContext.php @@ -4,6 +4,12 @@ use Symfony\Component\HttpKernel\KernelInterface; use Behat\Symfony2Extension\Context\KernelAwareContext; +use PHPUnit\Framework\Assert; + +// BC Layer for older PHPUnit versions. +if (!class_exists('PHPUnit\Framework\Assert')) { + class_alias('PHPUnit_Framework_Assert', 'PHPUnit\Framework\Assert'); +} class FeatureContext implements KernelAwareContext { @@ -27,7 +33,7 @@ public function setKernel(KernelInterface $kernel) */ public function iHaveAKernelInstance() { - \PHPUnit_Framework_Assert::assertInstanceOf('Symfony\\Component\\HttpKernel\\KernelInterface', $this->kernel); + Assert::assertInstanceOf('Symfony\\Component\\HttpKernel\\KernelInterface', $this->kernel); } /** @@ -43,7 +49,7 @@ public function iGetContainerParametersFromIt() */ public function thereShouldBeParameter($key) { - \PHPUnit_Framework_Assert::assertArrayHasKey($key, $this->containerParameters); + Assert::assertArrayHasKey($key, $this->containerParameters); $this->parameterKey = $key; } @@ -52,7 +58,7 @@ public function thereShouldBeParameter($key) */ public function thereShouldNotBeParameter($key) { - \PHPUnit_Framework_Assert::assertArrayNotHasKey($key, $this->containerParameters); + Assert::assertArrayNotHasKey($key, $this->containerParameters); } /** @@ -60,7 +66,7 @@ public function thereShouldNotBeParameter($key) */ public function itShouldBeSetToValue($val) { - \PHPUnit_Framework_Assert::assertSame($val, $this->containerParameters[$this->parameterKey]); + Assert::assertSame($val, $this->containerParameters[$this->parameterKey]); } /** @@ -68,7 +74,7 @@ public function itShouldBeSetToValue($val) */ public function theValueShouldBeAnArray() { - \PHPUnit_Framework_Assert::assertInternalType('array', $this->containerParameters[$this->parameterKey]); + Assert::assertInternalType('array', $this->containerParameters[$this->parameterKey]); } /** @@ -78,7 +84,7 @@ public function theValueShouldBeAnArray() public function theArrayShouldContainOnlyTheValues($arg) { $values = explode(',', $arg); - - \PHPUnit_Framework_Assert::assertSame($values, $this->containerParameters[$this->parameterKey]); + + Assert::assertSame($values, $this->containerParameters[$this->parameterKey]); } }