language: php

php:
  - 5.3
  - 5.4
  - 5.5
  - hhvm

env:
  - DB=mysql ENABLE_SECOND_LEVEL_CACHE=1
  - DB=pgsql ENABLE_SECOND_LEVEL_CACHE=1
  - DB=sqlite ENABLE_SECOND_LEVEL_CACHE=1
  - DB=mysql ENABLE_SECOND_LEVEL_CACHE=0
  - DB=pgsql ENABLE_SECOND_LEVEL_CACHE=0
  - DB=sqlite ENABLE_SECOND_LEVEL_CACHE=0

before_script:
  - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests;' -U postgres; fi"
  - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests_tmp;' -U postgres; fi"
  - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests;' -U postgres; fi"
  - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests_tmp;' -U postgres; fi"
  - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS doctrine_tests_tmp;create database IF NOT EXISTS doctrine_tests;'; fi"
  - composer install --prefer-dist --dev

script: phpunit -v --configuration tests/travis/$DB.travis.xml

after_script:
  - php vendor/bin/coveralls -v

matrix:
  allow_failures:
    - php: hhvm
  exclude:
    - php: hhvm
      env: DB=pgsql ENABLE_SECOND_LEVEL_CACHE=0  # driver currently unsupported by HHVM
    - php: hhvm
      env: DB=pgsql ENABLE_SECOND_LEVEL_CACHE=1 # driver currently unsupported by HHVM
    - php: hhvm
      env: DB=mysqli ENABLE_SECOND_LEVEL_CACHE=0  # driver currently unsupported by HHVM
    - php: hhvm
      env: DB=mysqli ENABLE_SECOND_LEVEL_CACHE=1 # driver currently unsupported by HHVM