language: php
dist: trusty
sudo: false

matrix:
    include:
        - php: 7.1
          env: SYMFONY_VERSION="3.4.*" COMPOSER_FLAGS="--prefer-lowest"
        - php: 7.2
          env: SYMFONY_VERSION="4.0.*" CS_FIXER=1
        - php: 7.3
          env: SYMFONY_VERSION="4.1.*"
        - php: 7.3
          env: SYMFONY_VERSION="4.2.*"
        - php: 7.3
          env: SYMFONY_VERSION="4.3.*"
        - php: 7.3
          env: SYMFONY_VERSION="4.4.*"
        - php: 7.3
          env: SYMFONY_VERSION="5.0.*"
        - php: 7.3
          env: SYMFONY_VERSION="dev-master" COMPOSER_DEV=1
    allow_failures:
        - php: 7.3
          env: SYMFONY_VERSION="dev-master" COMPOSER_DEV=1
    fast_finish: true

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

before_script:
    - composer self-update
    - if [ "$COMPOSER_DEV" == 1 ]; then composer config minimum-stability dev; fi
    - composer require --no-update symfony/framework-bundle=$SYMFONY_VERSION
    - composer require --no-update --dev symfony/form=$SYMFONY_VERSION symfony/twig-bundle=$SYMFONY_VERSION
    - composer update $COMPOSER_FLAGS --prefer-dist

script:
    - stty cols 120
    - if [ "$CS_FIXER" == 1 ]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.1/php-cs-fixer.phar && php php-cs-fixer.phar fix --dry-run --diff; fi
    - php vendor/bin/phpunit
