Skip to content

Commit d3edb4e

Browse files
authored
Updated travis yml to properly test different symfony versions (#221)
* Updated travis yml to properly test different symfony versions * Use tilde * Require phpunit bridge * Make sure test pass on phpunit 5.7 * Removed phpunit/phpunit * Require config-test 2.0 * remove PHP 7.2 since it is failing on some weird test issue * latest phpunit bridge support php7 * specify PHPUnit version * typo * specify different phpunit versions * Removed phpunit * Updated comment * Run simple-phpunit install * Using phpunit-bridge 3.3 * updated comment
1 parent baadcd4 commit d3edb4e

File tree

3 files changed

+50
-27
lines changed

3 files changed

+50
-27
lines changed

.travis.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@ cache:
66
directories:
77
- $HOME/.composer/cache/files
88

9-
php:
10-
- 5.5
11-
- 5.6
12-
- 7.0
13-
- 7.1
14-
- 7.2
15-
169
env:
1710
global:
1811
- TEST_COMMAND="composer test"
12+
- SYMFONY_PHPUNIT_VERSION="6.3"
1913

2014
branches:
2115
except:
@@ -24,26 +18,48 @@ branches:
2418
matrix:
2519
fast_finish: true
2620
include:
21+
# Minimum supported Symfony version and latest PHP version
22+
- php: 7.1
23+
env: DEPENDENCIES="minimum" COVERAGE=true TEST_COMMAND="composer test-ci" SYMFONY_DEPRECATIONS_HELPER="weak" SYMFONY_PHPUNIT_VERSION="5.7"
24+
25+
# Test the latest stable release
2726
- php: 5.5
28-
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
29-
- php: 7.2
30-
env: DEPENDENCIES=dev
31-
- php: hhvm
32-
dist: trusty
33-
# Test against LTS versions
27+
env: SYMFONY_PHPUNIT_VERSION="5.7"
28+
- php: 5.6
29+
env: SYMFONY_PHPUNIT_VERSION="5.7"
3430
- php: 7.0
35-
env: SYMFONY_VERSION=2.8.*
31+
- php: 7.1
32+
- php: 7.2
33+
34+
# Test LTS versions
35+
- php: 5.5
36+
env: DEPENDENCIES="symfony/lts:^2"
37+
- php: 5.5
38+
env: DEPENDENCIES="symfony/lts:^3"
39+
40+
# Latest commit to master
41+
- php: 7.1
42+
env: DEPENDENCIES="dev"
43+
44+
allow_failures:
45+
# dev-master is allowed to fail.
46+
- php: 7.1
47+
env: DEPENDENCIES="dev"
3648

3749
before_install:
38-
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
39-
- if [ "$DEPENDENCIES" = "dev" ]; then sed -i '/prefer-stable/d' composer.json; fi;
40-
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
41-
- if [ $COVERAGE != true ]; then phpenv config-rm xdebug.ini; fi;
50+
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
51+
- if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi;
52+
- if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi;
53+
- if [[ $DEPENDENCIES == *"/"* ]]; then composer require --no-update $DEPENDENCIES; fi;
4254

4355
install:
44-
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
56+
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
57+
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
58+
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
59+
- vendor/bin/simple-phpunit install
4560

4661
script:
62+
- composer validate --strict --no-check-lock
4763
- $TEST_COMMAND
4864

4965
after_success:

Tests/Unit/Collector/StackPluginTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Http\HttplugBundle\Collector\StackPlugin;
1212
use Http\Promise\FulfilledPromise;
1313
use Http\Promise\RejectedPromise;
14-
use PHPUnit\Framework\Error\Warning;
1514
use PHPUnit\Framework\TestCase;
1615
use Psr\Http\Message\RequestInterface;
1716
use Psr\Http\Message\ResponseInterface;
@@ -188,8 +187,17 @@ public function testOnError()
188187
$this->markTestSkipped();
189188
}
190189

191-
//PHPUnit wrap any \Error into a \PHPUnit\Framework\Error\Warning.
192-
$this->expectException(Warning::class);
190+
/*
191+
* Use the correct PHPUnit version
192+
* PHPUnit wrap any \Error into a \PHPUnit\Framework\Error\Warning.
193+
*/
194+
if (class_exists('PHPUnit_Framework_Error')) {
195+
// PHPUnit 5.7
196+
$this->setExpectedException(\PHPUnit_Framework_Error::class);
197+
} else {
198+
// PHPUnit 6.0 and above
199+
$this->expectException(\PHPUnit\Framework\Error\Warning::class);
200+
}
193201

194202
$this->collector
195203
->expects($this->once())

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@
3333
"symfony/dependency-injection": "^2.8.3 || ^3.0.3"
3434
},
3535
"require-dev": {
36-
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.1",
3736
"phpunit/php-token-stream": "^1.1.8",
3837
"php-http/curl-client": "^1.0",
3938
"php-http/socket-client": "^1.0",
4039
"php-http/guzzle6-adapter": "^1.1.1",
4140
"php-http/react-adapter": "^0.2.1",
4241
"php-http/buzz-adapter": "^0.3",
4342
"php-http/mock-client": "^1.0",
44-
"symfony/phpunit-bridge": "^3.2",
43+
"symfony/phpunit-bridge": "^3.3 || ^4.0",
4544
"symfony/twig-bundle": "^2.8 || ^3.0",
4645
"symfony/twig-bridge": "^2.8 || ^3.0",
4746
"symfony/web-profiler-bundle": "^2.8 || ^3.0",
@@ -50,7 +49,7 @@
5049
"symfony/browser-kit": "^2.8 || ^3.0",
5150
"symfony/dom-crawler": "^2.8 || ^3.0",
5251
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
53-
"matthiasnoback/symfony-dependency-injection-test": "^1.0 || ^2.0",
52+
"matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.0",
5453
"nyholm/nsa": "^1.1"
5554
},
5655
"conflict": {
@@ -69,8 +68,8 @@
6968
]
7069
},
7170
"scripts": {
72-
"test": "vendor/bin/phpunit",
73-
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
71+
"test": "vendor/bin/simple-phpunit",
72+
"test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml"
7473
},
7574
"extra": {
7675
"branch-alias": {

0 commit comments

Comments
 (0)