language: php

dist: bionic

services:
  - mysql
  - postgresql

addons:
  postgresql: "9.4"

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

php:
  - 7.2
  - 7.3

env:
  - LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-lowest' DB_CONNECTION='mysql' DB_DATABASE='translatable_test' DB_USERNAME='travis'
  - LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-stable' DB_CONNECTION='mysql' DB_DATABASE='translatable_test' DB_USERNAME='travis'
  - LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-lowest' DB_CONNECTION='mysql' DB_DATABASE='translatable_test' DB_USERNAME='travis'
  - LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-stable' DB_CONNECTION='mysql' DB_DATABASE='translatable_test' DB_USERNAME='travis'

matrix:
  include:
    - php: 7.4
      env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-lowest' DB_CONNECTION='mysql' DB_DATABASE='translatable_test' DB_USERNAME='travis'
    - php: 7.4
      env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-stable' DB_CONNECTION='mysql' DB_DATABASE='translatable_test' DB_USERNAME='travis'
    - php: 7.4
      env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-stable' DB_CONNECTION='pgsql' DB_DATABASE='translatable_test' DB_USERNAME='postgres'
  fast_finish: true

before_install:
  - sh -c "if [ '$DB_CONNECTION' = 'mysql' ]; then mysql -e 'CREATE DATABASE translatable_test;'; fi"
  - sh -c "if [ '$DB_CONNECTION' = 'pgsql' ]; then psql -c 'create database translatable_test;' -U postgres; fi"
  - composer config discard-changes true
  - travis_retry composer self-update
  - travis_retry composer require --dev "laravel/framework:${LARAVEL}" --no-interaction --no-update

install:
  - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-suggest --no-interaction

script:
  - vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
  - wget https://scrutinizer-ci.com/ocular.phar
  - php ocular.phar code-coverage:upload --format=php-clover coverage.clover

notifications:
  slack:
    secure: Mvg61/n1NVIr+LBD+eMymVugFtX0CW/xv6k/RpR5tV+dSvzvs8Vvk23UyslR+UvsYtJ7mDzoWxHBTASi/8cKgchIhotzUSqPC3sepaerwOxDxELMNEUw/XCPEftCVZRcUaLGgIPMjYPU5hhnN5sEDPcSrrkM1nw+TBalWiJN0qyWCZ3JsWSPqMpKCEdx2VFgnbTQd4apJz7Ul7H9YqEVfUPD2Mu7ZlmWwQc3YKrSkEFVds46W8tr07vS9a4SL5A9Xtt+0S1bPJBeCdH6DDIfRAOtAap2pEBSe5cpXX1RVH7MdHM6Kges9bxekVT3Cbrd9mULSqsDPB2ii17yum20TGk8tEsoawr2GhrjCc8mCg9fPWh9oq87WvNXQsZWlCnKG30Wnp/9HGF3y/gEBkpUNKzQzvVbeTPIYQ6kfEb5nJOXoQZ10TsSRtRtFCQG5Sei39hWzD/wCGo8kVqVxcSyJcZMS60gWB5c8/cu0E20IVf6ixymTOpqUAx4rwtDGvztkAnKmogm+SOWy6YPWOJrl1GeVK+gSwMSeZSCs2Ghkyi/XILsa/Jb6sDarrj+RYbJdEjLIGzj5sBsQugBBVXeg1mBUXWVsZBa55bpKlJWQjCZkHZ4F81LD19bkEaI3Olam1DHafjmFbKWYaNZ+mrYiAOvWp5QxOqEipTxS1KeprI=