language: php

dist: trusty
sudo: false

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

env:
    global:
        - SYMFONY_PHPUNIT_DIR=.phpunit
        - XDEBUG_MODE=coverage

matrix:
  fast_finish: true
  include:
    - php: 7.1
      env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
    - php: 7.1
      env: SYMFONY_VERSION="4.4.*"
    # Test against seldaek/monolog 1.x
    - php: 7.2
      env: MONOLOG_VERSION=1.*
    - php: 7.3
      env: MONOLOG_VERSION=1.*
    - php: 7.4
      env: MONOLOG_VERSION=1.*
    # Test against seldaek/monolog 2.x
    - php: 7.2
      env: MONOLOG_VERSION=2.*
    - php: 7.3
      env: MONOLOG_VERSION=2.*
    - php: 7.4
      env: MONOLOG_VERSION=2.*
    # Test against dev versions
    - php: nightly
      env: DEPENDENCIES=dev MONOLOG_VERSION=1.*
    - php: nightly
      env: DEPENDENCIES=dev MONOLOG_VERSION=2.*
  allow_failures:
    - php: nightly

before_install:
    - composer self-update
    - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
    - if [ "$MONOLOG_VERSION" != "" ]; then composer require --dev --no-update monolog/monolog:"$MONOLOG_VERSION"; fi;
    - if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev --no-update symfony/symfony:"$SYMFONY_VERSION"; fi

install:
    - composer update $COMPOSER_FLAGS
    - ./vendor/bin/simple-phpunit install

script: ./vendor/bin/simple-phpunit -v --coverage-text
