Skip to content

Commit 76e6d8b

Browse files
authored
Better travis file (#185)
* Better travis file * cs * Add compiler pass to make sure we deal with public services
1 parent 8c5b236 commit 76e6d8b

File tree

5 files changed

+67
-36
lines changed

5 files changed

+67
-36
lines changed

.travis.yml

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,60 @@
11
language: php
2-
32
sudo: false
4-
53
cache:
6-
directories:
7-
- $HOME/.composer/cache
8-
9-
php:
10-
- 7.0
11-
- 7.1
4+
directories:
5+
- $HOME/.composer/cache/files
6+
- $HOME/symfony-bridge/.phpunit
127

138
env:
14-
global:
15-
- TEST_COMMAND="composer test"
16-
matrix:
17-
- SYMFONY_VERSION=3.3.*
9+
global:
10+
- PHPUNIT_FLAGS="-v --testsuite main"
11+
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
1812

1913
matrix:
20-
fast_finish: true
21-
allow_failures:
22-
- php: 7.1
23-
env: SYMFONY_VERSION=4.0.*
24-
include:
25-
- php: 7.0
26-
env: TEST_COMMAND="composer test-ci" COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_VERSION=3.3.* COVERAGE=true
27-
- php: 7.0
28-
# We need `--prefer-source`, otherwise the `Doctrine\Tests\OrmTestCase` class won't be found.
29-
env: TEST_COMMAND="phpunit --testsuite doctrine" COMPOSER_FLAGS="--prefer-source" SYMFONY_VERSION="3.3.* phpunit/phpunit:^5.7"
30-
- php: 7.1
31-
env: SYMFONY_VERSION=4.0.*
32-
33-
before_script:
34-
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
35-
- composer update $COMPOSER_FLAGS
14+
fast_finish: true
15+
include:
16+
# Minimum supported dependencies with the latest and oldest PHP version
17+
- php: 7.2
18+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
19+
- php: 7.0
20+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
21+
22+
# Test the latest stable release
23+
- php: 7.0
24+
- php: 7.1
25+
- php: 7.2
26+
env: COVERAGE=true PHPUNIT_FLAGS="-v --testsuite main --coverage-text --coverage-clover=build/coverage.xml"
27+
28+
- php: 7.1
29+
# We need `--prefer-source`, otherwise the `Doctrine\Tests\OrmTestCase` class won't be found.
30+
env: PHPUNIT_FLAGS="-v --testsuite doctrine" COMPOSER_FLAGS="--prefer-source" DEPENDENCIES="dunglas/symfony-lock:^3""
31+
- php: 7.2
32+
env: DEPENDENCIES="dunglas/symfony-lock:^3"
33+
- php: 7.2
34+
env: DEPENDENCIES="dunglas/symfony-lock:^4"
35+
36+
# Latest commit to master
37+
- php: 7.2
38+
env: STABILITY="dev"
39+
40+
allow_failures:
41+
# Dev-master is allowed to fail.
42+
- env: STABILITY="dev"
43+
44+
before_install:
45+
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
46+
- if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
47+
- if ! [ -v "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
48+
49+
install:
50+
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
51+
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
52+
- composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
53+
- ./vendor/bin/simple-phpunit install
3654

3755
script:
38-
- $TEST_COMMAND
56+
- composer validate --strict --no-check-lock
57+
- ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
3958

4059
after_success:
4160
- if [[ $COVERAGE = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi

DependencyInjection/Compiler/FactoryValidatorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
1818

1919
/**
20-
* Make sure that the factory actually exists
20+
* Make sure that the factory actually exists.
2121
*
2222
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2323
*/

Tests/Functional/BundleInitializationTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,20 @@
1616
use Geocoder\Plugin\Plugin\CachePlugin;
1717
use Geocoder\Plugin\PluginProvider;
1818
use Geocoder\Provider\GoogleMaps\GoogleMaps;
19-
use Geocoder\Provider\Provider;
2019
use Geocoder\ProviderAggregator;
2120
use Nyholm\BundleTest\BaseBundleTestCase;
21+
use Nyholm\BundleTest\CompilerPass\PublicServicePass;
2222
use Nyholm\NSA;
2323

2424
class BundleInitializationTest extends BaseBundleTestCase
2525
{
26+
protected function setUp()
27+
{
28+
parent::setUp();
29+
$this->addCompilerPass(new PublicServicePass('|[Bb]azinga:*|'));
30+
$this->addCompilerPass(new PublicServicePass('|[gG]eocoder:*|'));
31+
}
32+
2633
protected function getBundleClass()
2734
{
2835
return BazingaGeocoderBundle::class;

Tests/Functional/ProviderFactoryTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,20 @@
3333
use Geocoder\Provider\Nominatim\Nominatim;
3434
use Geocoder\Provider\OpenCage\OpenCage;
3535
use Geocoder\Provider\PickPoint\PickPoint;
36-
use Geocoder\Provider\Provider;
3736
use Geocoder\Provider\TomTom\TomTom;
3837
use Geocoder\Provider\Yandex\Yandex;
3938
use Nyholm\BundleTest\BaseBundleTestCase;
39+
use Nyholm\BundleTest\CompilerPass\PublicServicePass;
4040
use Nyholm\NSA;
4141

4242
class ProviderFactoryTest extends BaseBundleTestCase
4343
{
44+
protected function setUp()
45+
{
46+
parent::setUp();
47+
$this->addCompilerPass(new PublicServicePass('|bazinga.*|'));
48+
}
49+
4450
protected function getBundleClass()
4551
{
4652
return BazingaGeocoderBundle::class;

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"symfony/console": "^3.3 || ^4.0"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^6.2",
22+
"symfony/phpunit-bridge": "^3.4 || ^4.0",
2323
"symfony/yaml": "^3.3 || ^4.0",
2424
"geoip/geoip": "~1.17",
2525
"doctrine/cache": "~1.3",
@@ -28,7 +28,7 @@
2828
"php-http/curl-client": "^1.7",
2929
"nyholm/psr7": "^0.2.2",
3030
"nyholm/nsa": "^1.1",
31-
"nyholm/symfony-bundle-test": "^1.2",
31+
"nyholm/symfony-bundle-test": "^1.3",
3232
"geocoder-php/google-maps-provider": "^4.0",
3333
"geocoder-php/cache-provider": "^4.0",
3434
"geocoder-php/arcgis-online-provider": "^4.0",
@@ -61,8 +61,7 @@
6161
}
6262
},
6363
"scripts": {
64-
"test": "vendor/bin/phpunit --testsuite main",
65-
"test-ci": "vendor/bin/phpunit --testsuite main --coverage-text --coverage-clover=build/coverage.xml"
64+
"test": "vendor/bin/simple-phpunit --testsuite main"
6665
},
6766
"minimum-stability": "dev",
6867
"prefer-stable": true,

0 commit comments

Comments
 (0)