language: php

php:
  - 5.4
  - 5.5
#  - hhvm # commented until composer or hhvm get fixed: https://github.com/facebook/hhvm/issues/1347

services:
  - redis-server
  - memcached
  - elasticsearch
  - mongodb

install:
  - composer self-update && composer --version
# core framework:
#  - composer require satooshi/php-coveralls 0.6.* --dev --prefer-dist
  - composer install --prefer-dist
  - tests/unit/data/travis/mongodb-setup.sh
  - tests/unit/data/travis/apc-setup.sh
  - tests/unit/data/travis/memcache-setup.sh
  - tests/unit/data/travis/cubrid-setup.sh
# basic application:
  - composer install --dev --prefer-dist -d apps/basic
  - cd apps/basic && php vendor/bin/codecept build && cd ../..
  - cd apps && php -S localhost:8080 &

before_script:
  - echo 'elasticsearch version ' && curl http://localhost:9200/
  - mysql -e 'CREATE DATABASE yiitest;';
  - psql -U postgres -c 'CREATE DATABASE yiitest;';
  - tests/unit/data/travis/sphinx-setup.sh
  - mongo yii2test --eval 'db.addUser("travis", "test");'

script:
#  - vendor/bin/phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor
  - vendor/bin/phpunit --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor
  - cd apps/basic && php vendor/bin/codecept run

#after_script:
#  - php vendor/bin/coveralls
