Skip to content

Commit

Permalink
Merge pull request travis-ci#109 from travis-ci/php_env_example_update
Browse files Browse the repository at this point in the history
updated the section on env's to be clearer
  • Loading branch information
Michael Klishin committed Jul 19, 2012
2 parents 52f519e + 3a7b999 commit 52f64f0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions docs/user/languages/php.md
Expand Up @@ -68,20 +68,28 @@ Even though installed dependencies will be wiped out between builds (VMs we run
If you need to test against multiple versions of, say, Symfony, you can instruct Travis to do multiple runs with different sets or values of environment variables. Use *env* key in your .travis.yml file, for example:

env:
- SYMFONY_VERSION=v2.0.5
- SYMFONY_VERSION=origin/master
- SYMFONY_VERSION=2.0.*,DB=mysql
- SYMFONY_VERSION=dev-master,DB=mysql

and then use ENV variable values in your dependencies installation scripts, test cases or test script parameter values. Here we use DB variable value to pick phpunit configuration file:
and then use ENV variable values in any later script like your dependencies installation scripts, test cases or test script parameter values.

Here is an example using the above ENV variable to modify the dependencies when using the composer package manager to run the tests against the 2 differnt versions of Symfony as defined above.

before_script:
- curl -s http://getcomposer.org/installer | php --
- php composer.phar require symfony/framework-bundle:${SYMFONY_VERSION}

Here we use DB variable value to pick phpunit configuration file:

script: phpunit --configuration $DB.phpunit.xml

The same technique is often used to test projects against multiple databases and so on.

To see real world examples, see:

* [FOSUserBundle](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/.travis.yml)
* [FOSRest](https://github.com/FriendsOfSymfony/FOSRest/blob/master/.travis.yml)
* [doctrine2](https://github.com/pborreli/doctrine2/blob/master/.travis.yml)
* [LiipHyphenatorBundle](https://github.com/liip/LiipHyphenatorBundle/blob/master/.travis.yml)
* [doctrine2](https://github.com/doctrine/doctrine2/blob/master/.travis.yml)

### Installing PEAR packages

Expand Down

0 comments on commit 52f64f0

Please sign in to comment.