language: php

php:
  - 5.6
  - 7.0
  - 7.1

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

before_install:
 - nvm install 7
 - nvm use 7

install:
  - yes '' | pecl install solr
  - cd ../..
  - git clone --depth 1 https://github.com/omeka/omeka-s.git
  - git clone --depth 1 https://github.com/biblibre/omeka-s-module-Search.git omeka-s/modules/Search
  - cp -a $(readlink -e $(cd -)) omeka-s/modules/Solr
  - cd omeka-s
  - npm install
  - ./node_modules/gulp/bin/gulp.js init

before_script:
  - mysql -e "create database IF NOT EXISTS omeka_test;" -uroot
  - sed -i 's/^host.*/host = "localhost"/' application/test/config/database.ini
  - sed -i 's/^user.*/user = "root"/' application/test/config/database.ini
  - sed -i 's/^dbname.*/dbname = "omeka_test"/' application/test/config/database.ini
  - cd modules/Solr
  - composer install
  - cd test

script: ../../../vendor/bin/phpunit
