language: php
php:
  - 5.4
  - 5.6
  - 7.0
  - 7.1
  - hhvm
env: PHPV=0
matrix:
  include:
    - php: 5.2
      dist: precise
      env: PHPV=52
    - php: 5.3
      dist: precise
before_install: |
  if [ "$PHPV" -eq 52 ]; then
    pecl install phar
  fi
install: |
  if [ "$PHPV" -ne 52 ]; then
    composer install
  else
    # special handling for PHP 5.2 testing as there is no composer available
    export X="$HOME/.idiorm/bin"
    mkdir -p "$X"
    curl -sSfL https://github.com/treffynnon/php5.2-phpunit3.6.12-phar/releases/download/1.0.2/php52-phpunit.phar -o "$X/phpunit"
    chmod +x "$X/phpunit"
  fi
script: |
  if [ "$PHPV" -ne 52 ]; then
    composer run-script test -- --colors --coverage-text
  else
    # special handling for PHP 5.2 testing as there is no composer available
    # we need phpunit-3.6.12, but there is no phar file for it so comment out for now
    $X/phpunit --colors --coverage-text
  fi
cache:
  directories:
    - $HOME/.composer/cache
    - $HOME/.idiorm
    - vendor