sudo: false

dist: trusty

language: php

php:
  - '5.4'
  - '5.5'
  - '5.6'
  - '7.0'
  - '7.1'
  - '7.2'
  - '7.3'

matrix:
  include:
    - php: '5.3'
      dist: precise

notifications:
  email:
    on_success: change
    on_failure: change

before_script:
  # PHP_CodeSniffer
  - curl -L -o phpcs.phar https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.1/phpcs.phar
  # PHPUnit - manually download old version so that it works on PHP 7
  - curl -L -o phpunit.phar https://phar.phpunit.de/phpunit-4.8.35.phar
  # Basic config required for PHPUnit
  - cp qa-tests/phpunit-qa-config.php qa-config.php

script:
  # PHP_CodeSniffer
  - php phpcs.phar --report=emacs --extensions=php --standard=qa-tests/phpcs/ruleset.xml .
  - php phpcs.phar --report=emacs --extensions=php --standard=qa-tests/phpcs/ruleset-strict.xml qa-src/
  # PHPUnit
  - php phpunit.phar --bootstrap qa-tests/autoload.php qa-tests

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

git:
  depth: 5

