language: php

php:
  - 5.4
  - 5.5
  - 5.6
  - 7.0
  - 7.1
  - 7.2

matrix:
  fast_finish: true
  allow_failures:
    - php: hhvm
  include:
    # test against the latest HHVM version by using a newer image
    - php: hhvm
      sudo: true
      dist: trusty
      group: edge # Use edge image until the next travis CI image update
      before_install:
        - composer require --prefer-dist --no-interaction 'phpunit/phpunit:<6.0'
      script:
        - vendor/bin/phpunit --verbose $PHPUNIT_FLAGS

# faster builds on new travis setup not using sudo
sudo: false

# cache vendor dirs
cache:
  directories:
    - $HOME/.composer/cache

install:
  - travis_retry composer self-update && composer --version
  - export PATH="$HOME/.composer/vendor/bin:$PATH"
  - travis_retry composer install --prefer-dist --no-interaction

before_script:
  - |
    if [ $TRAVIS_PHP_VERSION = '5.6' ]; then
      PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
    fi
  - composer require --prefer-dist --no-interaction 'phpunit/phpunit:4.8.27|~5.7.21|^6.2'

script:
  - vendor/bin/phpunit --verbose $PHPUNIT_FLAGS
