16 # This is mandatory or the 'apt-get install' calls following will fail
17 - sudo apt-get update -qq
18 - sudo apt-get install -y apache2 libapache2-mod-fastcgi
19 - sudo apt-get install -y privoxy
21 # Disable xdebug for speed (executing composer), but allow us to re-enable it later
22 # NB: 'php -i' does not work on hhvm
23 - if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then export XDEBUG_INI=''; fi
24 - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then export XDEBUG_INI=`php -i | grep xdebug.ini | grep home/travis | grep -v '=>' | head -1`; fi
25 - export XDEBUG_INI=${XDEBUG_INI/,/}
26 - if [ "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI" "$XDEBUG_INI.bak"; fi
29 - composer self-update && composer install
31 # Re-enable xdebug for when we need to generate code coverage
32 - export COVERAGE_OPTS=""
33 - if [ "$TRAVIS_PHP_VERSION" = "5.6" -a "$XDEBUG_INI" != "" ]; then mv "$XDEBUG_INI.bak" "$XDEBUG_INI" && export COVERAGE_OPTS="--coverage-clover=coverage.clover"; fi
36 # Set up Apache and Privoxy instances inside the Travis VM and use them for testing against
37 - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then ./tests/ci/travis/setup_php_fpm.sh; ./tests/ci/travis/setup_apache.sh; fi
38 - if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then ./tests/ci/travis/setup_hhvm.sh; ./tests/ci/travis/setup_apache_hhvm.sh; fi
39 - ./tests/ci/travis/setup_privoxy.sh
41 # output what version of phpunit we got going
42 - vendor/bin/phpunit --version
45 # Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
46 # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below
47 vendor/bin/phpunit $COVERAGE_OPTS tests LOCALSERVER=localhost URI=/demo/server/server.php HTTPSSERVER=localhost HTTPSURI=/demo/server/server.php PROXY=localhost:8080 HTTPSVERIFYHOST=0 HTTPSIGNOREPEER=1 SSLVERSION=3 DEBUG=1
50 # Save as much info as we can to help developers
51 - cat apache_error.log
52 - cat apache_access.log
53 #- if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then cat /var/log/hhvm/error.log; fi
56 # Upload code-coverage to Scrutinizer
57 - if [ -f coverage.clover ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
58 - if [ -f coverage.clover ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
59 # Upload code-coverage CodeClimate
60 - if [ -f coverage.clover ]; then CODECLIMATE_REPO_TOKEN=7fa6ee01e345090e059e5e42f3bfbcc8692feb8340396382dd76390a3019ac13 ./vendor/bin/test-reporter --coverage-report=coverage.clover; fi
62 # reduce depth (history) of git checkout