language: php

php:
  - 7.0
  - 7.1
  - 7.2

sudo: false

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

git:
  depth: 1

matrix:
  include:
    - php: 7.0
      env:
        - COMPOSER_FLAGS="--prefer-stable --prefer-lowest"

before_script:
  - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source

script:
  - vendor/bin/phpunit

after_script:
  - bash -c '[[ -f "build/logs/clover.xml" ]] && wget https://scrutinizer-ci.com/ocular.phar'
  - bash -c '[[ -f "build/logs/clover.xml" ]] && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml'
