language: php

sudo: false

cache:
    directories:
        - $HOME/.composer/cache/files

matrix:
    include:
        - php: 5.3
        - php: 5.4
        - php: 5.5
        - php: 5.6
        - php: 5.3
          env: deps=low
        - php: 5.6
          env: deps=high
        - php: 7.0
        - php: hhvm
    allow_failures:
        - php: hhvm
    fast_finish: true

env:
    global:
        - deps=no
        - SYMFONY_DEPRECATIONS_HELPER=weak

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;
    - if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
    - if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
    - if [ "$deps" = "high" ]; then composer --prefer-source update; fi;
    - if [ "$deps" = "low" ]; then composer --prefer-source --prefer-lowest --prefer-stable update; fi;

script:
    - phpunit
