language: php

sudo: false

env:
    global:
        - SYMFONY_DEPRECATIONS_HELPER=weak

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

before_install:
    - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi

before_script:
    # Twig 1.x
    - if [[ $TWIG_VERSION != 2.0 ]]; then sed -i 's/~1.8|~2.0/~1.8/g' composer.json; fi

    # Symfony 2.8
    - if [[ $SYMFONY_DEPS_VERSION = 2.8 ]]; then sed -i 's/~2\.8|^3\.0/2.8.*@dev/g' composer.json; fi
    # Symfony 3.0
    - if [[ $SYMFONY_DEPS_VERSION = 3.0 ]]; then sed -i 's/~2\.8|^3\.0/3.0.*@dev/g' composer.json; fi
    # Symfony 3.1
    - if [[ $SYMFONY_DEPS_VERSION = 3.1 ]]; then sed -i 's/~2\.8|^3\.0/3.1.*@dev/g' composer.json; fi
    # Symfony 3.2
    - if [[ $SYMFONY_DEPS_VERSION = 3.2 ]]; then sed -i 's/~2\.8|^3\.0/3.2.*@dev/g' composer.json; fi
    # Symfony 3.3
    - |
      if [[ $SYMFONY_DEPS_VERSION = 3.3 ]]; then
          sed -i 's/~2\.8|^3\.0/3.3.*@dev/g' composer.json;
          composer require --dev --no-update symfony/web-link:3.3.*
      fi

    - composer update --no-suggest

script: ./vendor/bin/simple-phpunit

matrix:
    include:
        - php: 5.5
        - php: 5.6
          env: TWIG_VERSION=2.0
        - php: 5.6
          env: SYMFONY_DEPS_VERSION=2.8
        - php: 5.6
          env: SYMFONY_DEPS_VERSION=3.0
        - php: 5.6
          env: SYMFONY_DEPS_VERSION=3.1
        - php: 5.6
          env: SYMFONY_DEPS_VERSION=3.2
        - php: 5.6
          env: SYMFONY_DEPS_VERSION=3.3
        - php: 5.6
        - php: 7.0
        - php: 7.1
        - php: 7.2
        - php: hhvm
          dist: trusty
