Skip to content

Commit 8be6400

Browse files
authored
Updated travis config (#73)
* Test better on symfony 4 * Fixed tests * Better deps * Bugfix
1 parent a90d14d commit 8be6400

File tree

3 files changed

+77
-46
lines changed

3 files changed

+77
-46
lines changed

.travis.yml

+58-33
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,76 @@ services:
55
- redis-server
66
- memcached
77

8-
php:
9-
- 7.1
10-
- 7.0
11-
- 5.6
8+
cache:
9+
directories:
10+
- $HOME/.composer/cache/files
11+
- $HOME/symfony-bridge/.phpunit
1212

1313
env:
14-
global:
15-
- COMPOSER_COMMAND="composer install --prefer-dist"
16-
- TEST_COMMAND="php vendor/bin/phpunit"
17-
- COVERAGE=false
18-
matrix:
19-
- SYMFONY_VERSION=2.7.*
20-
- SYMFONY_VERSION=2.8.*
21-
- SYMFONY_VERSION=3.3.*
22-
- SYMFONY_VERSION=4.0.*
14+
global:
15+
- TEST_COMMAND="composer test"
16+
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
17+
- SYMFONY_DEPRECATIONS_HELPER="weak"
2318

2419
branches:
25-
except:
26-
- /^analysis-.*$/
27-
- /^patch-.*$/
20+
except:
21+
- /^analysis-.*$/
2822

2923
matrix:
30-
fast_finish: true
31-
include:
32-
- php: 5.6
33-
env: COMPOSER_COMMAND="composer update --prefer-lowest --prefer-stable" COVERAGE=true TEST_COMMAND="php -dzend_extension=xdebug.so vendor/bin/phpunit --coverage-clover=coverage.xml" SYMFONY_VERSION=2.7.*
34-
- php: hhvm
35-
env: SYMFONY_VERSION=3.3.*
36-
dist: trusty
24+
fast_finish: true
25+
include:
26+
# Minimum supported Symfony version and latest PHP version
27+
- php: 7.2
28+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak"
29+
- php: 5.6
30+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak"
3731

38-
cache:
39-
directories:
40-
- $HOME/.composer/cache
32+
# Test the latest stable release
33+
- php: 5.6
34+
- php: 7.0
35+
env: SYMFONY_PHPUNIT_VERSION="6.3"
36+
- php: 7.1
37+
env: SYMFONY_PHPUNIT_VERSION="6.3"
38+
- php: 7.2
39+
env: COVERAGE=true TEST_COMMAND="composer test-ci"
40+
41+
# Test LTS versions
42+
- php: 7.2
43+
env: DEPENDENCIES="dunglas/symfony-lock:^2"
44+
- php: 7.2
45+
env: DEPENDENCIES="dunglas/symfony-lock:^3"
46+
- php: 7.2
47+
env: DEPENDENCIES="dunglas/symfony-lock:^4"
48+
49+
# Latest commit to master
50+
- php: 7.2
51+
env: STABILITY="dev"
52+
53+
allow_failures:
54+
# dev stability is allowed to fail.
55+
- env: STABILITY="dev"
4156

4257
before_install:
43-
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-add .travis/phpconfig.ini; fi;
44-
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then phpenv config-rm xdebug.ini; fi;
45-
- pip install --user codecov
46-
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
58+
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
59+
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
60+
- if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
61+
- pip install --user codecov
4762

4863
install:
49-
- travis_retry ${COMPOSER_COMMAND} --no-interaction
64+
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
65+
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
66+
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
67+
- vendor/bin/simple-phpunit install
5068

5169
script:
52-
- $TEST_COMMAND
70+
- composer validate --strict --no-check-lock
71+
- $TEST_COMMAND
5372

5473
after_success:
55-
- if [[ "$COVERAGE" = true ]]; then codecov; fi
74+
- if [[ $COVERAGE = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
75+
- if [[ $COVERAGE = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi
76+
- if [[ "$COVERAGE" = true ]]; then codecov; fi
77+
78+
after_script:
79+
- wget http://tnyholm.se/reporter.phar
80+
- php reporter.phar build:upload

composer.json

+15-11
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@
2020
"require": {
2121
"php": "^5.6 || ^7.0",
2222
"cache/array-adapter": "^1.0",
23-
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0",
24-
"symfony/options-resolver": "^2.7 || ^3.0 || ^4.0",
23+
"cache/namespaced-cache": "^1.0",
2524
"psr/cache": "^1.0",
2625
"psr/log": "^1.0",
27-
"cache/namespaced-cache": "^1.0"
26+
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0",
27+
"symfony/options-resolver": "^2.7 || ^3.0 || ^4.0"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "^4.8.36 || ^5.5",
31-
"symfony/symfony": "^2.7 || ^3.0 || ^4.0",
32-
"matthiasnoback/symfony-dependency-injection-test": "^1.0",
33-
"nyholm/symfony-bundle-test": "^1.2.0",
3430
"cache/apc-adapter": "^1.0",
3531
"cache/apcu-adapter": "^1.0",
3632
"cache/chain-adapter": "^1.0",
@@ -39,11 +35,14 @@
3935
"cache/memcache-adapter": "^1.0",
4036
"cache/memcached-adapter": "^1.0",
4137
"cache/predis-adapter": "^1.0",
38+
"cache/prefixed-cache": "^1.0",
4239
"cache/redis-adapter": "^1.0",
4340
"cache/void-adapter": "^1.0",
44-
"cache/prefixed-cache": "^1.0",
4541
"doctrine/cache": "^1.6",
46-
"predis/predis": "^1.1"
42+
"matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.3",
43+
"nyholm/symfony-bundle-test": "^1.2.0",
44+
"predis/predis": "^1.1",
45+
"symfony/phpunit-bridge": "^3.3 || ^4.0"
4746
},
4847
"suggest": {
4948
"cache/*-adapter": "A actual implementation of PSR-6 cache",
@@ -59,6 +58,11 @@
5958
"Cache\\AdapterBundle\\Tests\\": "tests/"
6059
}
6160
},
62-
"minimum-stability": "dev",
63-
"prefer-stable": true
61+
"scripts": {
62+
"test": "vendor/bin/simple-phpunit",
63+
"test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml"
64+
},
65+
"config": {
66+
"sort-packages": true
67+
}
6468
}

src/DependencyInjection/CacheAdapterExtension.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Cache\AdapterBundle\DummyAdapter;
1515
use Symfony\Component\Config\FileLocator;
16+
use Symfony\Component\DependencyInjection\Alias;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\Loader;
1819
use Symfony\Component\DependencyInjection\Reference;
@@ -52,11 +53,12 @@ public function load(array $configs, ContainerBuilder $container)
5253

5354
$def = $container->register('cache.provider.'.$name, DummyAdapter::class);
5455
$def->setFactory([new Reference($arguments['factory']), 'createAdapter'])
55-
->addArgument($arguments['options']);
56+
->addArgument($arguments['options'])
57+
->setPublic(true);
5658

5759
$def->addTag('cache.provider');
5860
foreach ($arguments['aliases'] as $alias) {
59-
$container->setAlias($alias, 'cache.provider.'.$name);
61+
$container->setAlias($alias, new Alias('cache.provider.'.$name, true));
6062
}
6163
}
6264

0 commit comments

Comments
 (0)