diff --git a/.travis.yml b/.travis.yml index 8c24c0cf..bf2f057e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,16 +6,10 @@ cache: directories: - $HOME/.composer/cache/files -php: - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - env: global: - TEST_COMMAND="composer test" + - SYMFONY_PHPUNIT_VERSION="6.3" branches: except: @@ -24,26 +18,48 @@ branches: matrix: fast_finish: true include: + # Minimum supported Symfony version and latest PHP version + - php: 7.1 + env: DEPENDENCIES="minimum" COVERAGE=true TEST_COMMAND="composer test-ci" SYMFONY_DEPRECATIONS_HELPER="weak" SYMFONY_PHPUNIT_VERSION="5.7" + + # Test the latest stable release - php: 5.5 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" - - php: 7.2 - env: DEPENDENCIES=dev - - php: hhvm - dist: trusty - # Test against LTS versions + env: SYMFONY_PHPUNIT_VERSION="5.7" + - php: 5.6 + env: SYMFONY_PHPUNIT_VERSION="5.7" - php: 7.0 - env: SYMFONY_VERSION=2.8.* + - php: 7.1 + - php: 7.2 + + # Test LTS versions + - php: 5.5 + env: DEPENDENCIES="symfony/lts:^2" + - php: 5.5 + env: DEPENDENCIES="symfony/lts:^3" + + # Latest commit to master + - php: 7.1 + env: DEPENDENCIES="dev" + + allow_failures: + # dev-master is allowed to fail. + - php: 7.1 + env: DEPENDENCIES="dev" before_install: - - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; - - if [ "$DEPENDENCIES" = "dev" ]; then sed -i '/prefer-stable/d' composer.json; fi; - - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; - - if [ $COVERAGE != true ]; then phpenv config-rm xdebug.ini; fi; + - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi + - if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi; + - if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi; + - if [[ $DEPENDENCIES == *"/"* ]]; then composer require --no-update $DEPENDENCIES; fi; install: - - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction + # To be removed when this issue will be 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 ${COMPOSER_FLAGS} --prefer-dist --no-interaction + - vendor/bin/simple-phpunit install script: + - composer validate --strict --no-check-lock - $TEST_COMMAND after_success: diff --git a/Tests/Unit/Collector/StackPluginTest.php b/Tests/Unit/Collector/StackPluginTest.php index fd56b8f1..c7416008 100644 --- a/Tests/Unit/Collector/StackPluginTest.php +++ b/Tests/Unit/Collector/StackPluginTest.php @@ -11,7 +11,6 @@ use Http\HttplugBundle\Collector\StackPlugin; use Http\Promise\FulfilledPromise; use Http\Promise\RejectedPromise; -use PHPUnit\Framework\Error\Warning; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -188,8 +187,17 @@ public function testOnError() $this->markTestSkipped(); } - //PHPUnit wrap any \Error into a \PHPUnit\Framework\Error\Warning. - $this->expectException(Warning::class); + /* + * Use the correct PHPUnit version + * PHPUnit wrap any \Error into a \PHPUnit\Framework\Error\Warning. + */ + if (class_exists('PHPUnit_Framework_Error')) { + // PHPUnit 5.7 + $this->setExpectedException(\PHPUnit_Framework_Error::class); + } else { + // PHPUnit 6.0 and above + $this->expectException(\PHPUnit\Framework\Error\Warning::class); + } $this->collector ->expects($this->once()) diff --git a/composer.json b/composer.json index ad0fe1be..887d7365 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,6 @@ "symfony/dependency-injection": "^2.8.3 || ^3.0.3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.1", "phpunit/php-token-stream": "^1.1.8", "php-http/curl-client": "^1.0", "php-http/socket-client": "^1.0", @@ -41,7 +40,7 @@ "php-http/react-adapter": "^0.2.1", "php-http/buzz-adapter": "^0.3", "php-http/mock-client": "^1.0", - "symfony/phpunit-bridge": "^3.2", + "symfony/phpunit-bridge": "^3.3 || ^4.0", "symfony/twig-bundle": "^2.8 || ^3.0", "symfony/twig-bridge": "^2.8 || ^3.0", "symfony/web-profiler-bundle": "^2.8 || ^3.0", @@ -50,7 +49,7 @@ "symfony/browser-kit": "^2.8 || ^3.0", "symfony/dom-crawler": "^2.8 || ^3.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "matthiasnoback/symfony-dependency-injection-test": "^1.0 || ^2.0", + "matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.0", "nyholm/nsa": "^1.1" }, "conflict": { @@ -69,8 +68,8 @@ ] }, "scripts": { - "test": "vendor/bin/phpunit", - "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" + "test": "vendor/bin/simple-phpunit", + "test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml" }, "extra": { "branch-alias": {