language: php

env:
  global:
    SETUP=basic

matrix:
  include:
    - php: 5.5.9
      dist: trusty
    - php: 5.5
      dist: trusty
    - php: 5.6
      dist: xenial
      env: PHPUNIT_FLAGS="--coverage-clover build/logs/clover.xml"
      after_success: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
    - php: 5.6
      dist: xenial
      env: SETUP=lowest
    - php: hhvm-3.30
      dist: trusty
      before_install:
        - travis_retry composer require "phpunit/phpunit:^5.7.27" --dev --no-update --no-interaction
        - travis_retry composer require "mockery/mockery:^0.9.11" --dev --no-update --no-interaction

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

install:
  - if [[ "$SETUP" = "basic" ]]; then composer install --no-interaction --prefer-dist; fi
  - if [[ "$SETUP" = "lowest" ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi

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