dist: trusty
sudo: false
language: php
php:
  - 7.0.20
  - 7.1.9

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

before_script:
  - mysql -u root -e 'create database `bookstack-test`;'
  - mysql -u root -e "CREATE USER 'bookstack-test'@'localhost' IDENTIFIED BY 'bookstack-test';"
  - mysql -u root -e "GRANT ALL ON \`bookstack-test\`.* TO 'bookstack-test'@'localhost';"
  - mysql -u root -e "FLUSH PRIVILEGES;"
  - phpenv config-rm xdebug.ini
  - composer install --prefer-dist --no-interaction
  - php artisan clear-compiled -n
  - php artisan optimize -n
  - php artisan migrate --force -n --database=mysql_testing
  - php artisan db:seed --force -n --class=DummyContentSeeder --database=mysql_testing

after_failure:
  - cat storage/logs/laravel.log

script:
  - phpunit