language: php
sudo: false
cache:
  directories:
    - vendor
    - $HOME/.composer/cache
php:
  - 7.1
  - 7.2
  - 7.3
  - 7.4
  - 8.0  
  - 8.1
  - 8.2
  - 8.3

matrix:
  include:
    - php: 7.1
      dist: trusty
      env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'

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

script: vendor/phpunit/phpunit/phpunit $PHPUNIT_FLAGS

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

