language: php
sudo: false

php:
  - 5.3
  - 5.4
  - 5.5
  - 5.6
  - 7.0
  - nightly
  - hhvm

os:
  - linux

before_script:
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo 'opcache.enable=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" != "hhvm" ]; then echo 'opcache.enable_cli=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
  - if [ "`phpenv version-name`" == "hhvm" ]; then echo 'opcache.enable=1' >> /etc/hhvm/php.ini; fi
  - if [ "`phpenv version-name`" == "hhvm" ]; then echo 'opcache.enable_cli=1' >> /etc/hhvm/php.ini; fi
  - composer self-update
  - composer install -o --prefer-source

script:
# xdebug is not installed on HHVM and PHP 7, so we are skipping the creation of code coverage data there
  - if [ "`phpenv version-name`" == "5.3" ] || [ "`phpenv version-name`" == "5.4" ] || [ "`phpenv version-name`" == "5.5" ] || [ "`phpenv version-name`" == "5.6" ]; then vendor/bin/phpunit --colors --verbose --coverage-clover=coverage.clover; fi
  - if [ "`phpenv version-name`" != "5.3" ] && [ "`phpenv version-name`" != "5.4" ] && [ "`phpenv version-name`" != "5.5" ] && [ "`phpenv version-name`" != "5.6" ]; then vendor/bin/phpunit --colors --verbose; fi
  - vendor/bin/phpcs --standard=psr2 -np src tests
  - vendor/bin/php-cs-fixer fix --dry-run -vv

after_script:
# xdebug is not installed on HHVM and PHP 7, so we have no code coverage data to send
  - if [ "`phpenv version-name`" == "5.3" ] || [ "`phpenv version-name`" == "5.4" ] || [ "`phpenv version-name`" == "5.5" ] || [ "`phpenv version-name`" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
  - if [ "`phpenv version-name`" == "5.3" ] || [ "`phpenv version-name`" == "5.4" ] || [ "`phpenv version-name`" == "5.5" ] || [ "`phpenv version-name`" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

notifications:
  email: false
