language: php

sudo: false

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

env:
  global:
    - RUN_PHP_CS_FIXER=false
    - RUN_SCRUTINIZER=false
    - PHPUNIT_OPTIONS=""
    - COMPOSER_OPTIONS=""
    # MERCHANT_ID=1 PROJECT_ID=1 API_KEY=secret
    - secure: "Pov5XTt92woJ3jOQNCi7PazdVdu+vBhQy7rssM2GHTshUvqTtVZplTZryGVxZiJEjb1aRsIITeQfhOf3wTUT4gK+Q+WC+qNzP5udqJYwEwfhwQ0WZwDv//okBRG9oM5+zr+EztcXV3diW8PDFyIXMP691kok3CkZO2sCtP7uiR4="

matrix:
  fast_finish: true
  include:
    - php: 7.0
      env: RUN_PHP_CS_FIXER=true RUN_SCRUTINIZER=true PHPUNIT_OPTIONS="--coverage-clover=coverage.clover"
    - php: hhvm
      dist: trusty
      env: PHPUNIT_OPTIONS="--exclude-group webhook-php-server"
    - php: 5.3
      env: PHPUNIT_OPTIONS="--exclude-group webhook-php-server"
    - php: 5.3
      env: COMPOSER_OPTIONS="--prefer-lowest" PHPUNIT_OPTIONS="--exclude-group webhook-php-server"
    - php: 5.4
    - php: 5.5
    - php: 5.6

before_install:
    - phpenv config-rm xdebug.ini || true

install:
    - travis_retry composer update $COMPOSER_OPTS --no-interaction --prefer-dist

before_script:
  - if [ $RUN_PHP_CS_FIXER == true ]; then vendor/bin/php-cs-fixer fix --no-interaction --dry-run; fi;

script:
  - if [ $RUN_SCRUTINIZER == true ]; then phpdbg -qrr vendor/bin/phpunit $PHPUNIT_OPTIONS; else vendor/bin/phpunit $PHPUNIT_OPTIONS; fi;

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

notifications:
  slack:
    secure: "SeYovDlJ1wZ/8obJVytUssD9OU/hm5ea1KitEx3tP4YxZ22Cw0CRz4+1nN5S+BnIVp7Gl4lKmr3GmPTmXiVIFNDSRjYiw8njBw8lXBvxfIa51dPK/YH9OAvbM31SlRtM2a1G3UZ76IsBS1gU+F3xJwMJK8CBMd73kQbEBdCY7p4="
