language: php

sudo: false

cache:
    directories:
        - $HOME/.composer/cache/files
        - $HOME/symfony-bridge/.phpunit

matrix:
    include:
        - php: 5.3
          dist: 'precise'
        - php: 5.4
        - php: 5.5
        - php: 5.6
        - php: 5.3
          dist: 'precise'
          env: COMPOSER_OPTIONS="--prefer-lowest --prefer-stable" SYMFONY_DEPRECATIONS_HELPER=weak
        - php: 5.6
          env: COMPOSER_OPTIONS="" SYMFONY_DEPRECATIONS_HELPER=weak
        - php: 7.0
        - php: hhvm
    allow_failures:
        - php: hhvm
    fast_finish: true

env:
    global:
        - deps=no
        - SYMFONY_DEPRECATIONS_HELPER=strict
        - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
        - COMPOSER_OPTIONS="--prefer-stable"

before_install:
    - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
    - composer self-update
    - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
    - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
    # Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built
    - if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;

install:
    - if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then composer require --no-update zendframework/zend-diactoros; fi;
    - composer update --prefer-source $COMPOSER_OPTIONS
    - vendor/bin/simple-phpunit install

script:
    - vendor/bin/simple-phpunit
