language: php

sudo: false

php:
  - 5.4
  - 5.5
  - 5.6
  - hhvm

env:
  - DB=mysql PACKAGE_VERSION=high
  - DB=pgsql PACKAGE_VERSION=high
  - DB=sqlite PACKAGE_VERSION=high

sudo: false

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

matrix:
  allow_failures:
    - php: hhvm
    # hhvm will fail until libxml support is added https://github.com/facebook/hhvm/issues/1194
  include:
    - php: 5.3
      env: DB=mysql PACKAGE_VERSION=low
    - php: 5.3
      env: DB=pgsql PACKAGE_VERSION=low
    - php: 5.3
      env: DB=sqlite PACKAGE_VERSION=low

before_script:
  - composer selfupdate
  - rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
  - if [[ "$PACKAGE_VERSION" == "high" ]]; then composer update --prefer-dist --no-interaction; fi
  - if [[ "$PACKAGE_VERSION" == "low" ]]; then composer update --prefer-lowest --prefer-dist --no-interaction; fi
  - if [[ "$DB" == "mysql" ]]; then mysql -e "create database phpcr_tests;"; fi
  - if [[ "$DB" == "pgsql" ]]; then psql -c "create database phpcr_tests;" -U postgres; fi
  - php tests/generate_phpunit_config.php $DB

script: php vendor/bin/phpunit -c $DB.phpunit.xml

notifications:
  irc: "irc.freenode.org#jackalope"
