language: php

sudo: false

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

php:
  - 5.5
  - 5.6
  - 7.0
  - hhvm

matrix:
  allow_failures:
    - php: hhvm
  fast_finish: true
  include:
    - php: 5.5
      env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'

before_script:
    - if [[ $TRAVIS_PHP_VERSION  = '5.6' ]]; then PHPUNIT_FLAGS="--coverage-clover clover"; else PHPUNIT_FLAGS=""; fi
    - if [[ $TRAVIS_PHP_VERSION != '5.6' ]]; then phpenv config-rm xdebug.ini; fi
    - composer self-update
    - composer update $COMPOSER_FLAGS

script: vendor/bin/phpunit $PHPUNIT_FLAGS

after_success:
    - if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
    - if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then php ocular.phar code-coverage:upload --format=php-clover clover; fi

