@@ -166,6 +166,69 @@ the ``Tests/`` directory. Tests should follow the following principles:
166166 A test suite must not contain ``AllTests.php `` scripts, but must rely on the
167167 existence of a ``phpunit.xml.dist `` file.
168168
169+ Travis
170+ ------
171+
172+ A popular way to test open source bundles is by using `Travis CI `_. A good practice
173+ is to support at least the two latest LTS versions of symfony. One should also test
174+ test latest beta release. Here is a recommended configuration file (``.travis.yml ``).
175+
176+ .. code-block :: yaml
177+
178+ language : php
179+ sudo : false
180+ cache :
181+ directories :
182+ - $HOME/.composer/cache/files
183+ env :
184+ global :
185+ - TEST_COMMAND="phpunit"
186+
187+ matrix :
188+ fast_finish : true
189+ include :
190+ # Minimum supported PHP and Symfony version
191+ - php : 5.5
192+ env : DEPENDENCIES="minimum" COVERAGE=true TEST_COMMAND="phpunit --coverage-text"
193+
194+ # Test the latest stable release
195+ - php : 5.5
196+ - php : 5.6
197+ - php : 7.0
198+ - php : 7.1
199+ - php : 7.2
200+
201+ # Test LTS versions
202+ - php : 7.2
203+ env : DEPENDENCIES="symfony/lts:v2"
204+ - php : 7.2
205+ env : DEPENDENCIES="symfony/lts:v3"
206+
207+ # Latest beta release
208+ - php : 7.2
209+ env : DEPENDENCIES="beta"
210+
211+ allow_failures :
212+ # Latest beta is allowed to fail.
213+ - php : 7.2
214+ env : DEPENDENCIES="beta"
215+
216+ before_install :
217+ - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
218+ - if [ "$DEPENDENCIES" = "minimum" ]; then COMPOSER_FLAGS="--prefer-stable --prefer-lowest"; fi;
219+ - if [ "$DEPENDENCIES" = "beta" ]; then composer config minimum-stability beta; fi;
220+ - if [[ $DEPENDENCIES == *"/"* ]]; then composer require --no-update $DEPENDENCIES; fi;
221+
222+ install :
223+ # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
224+ - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
225+ - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
226+
227+ script :
228+ - $TEST_COMMAND
229+
230+
231+
169232 Installation
170233------------
171234
@@ -476,3 +539,4 @@ Learn more
476539.. _`Packagist` : https://packagist.org/
477540.. _`choose any license` : http://choosealicense.com/
478541.. _`valid license identifier` : https://spdx.org/licenses/
542+ .. _`Travis-CI` : travis-ci.org
0 commit comments