# This uses newer and faster docker based build system

language: php

notifications:
  on_success: never
  on_failure: change

services:
  - mysql

php:
  - nightly
  - 7.3
  - 7.0
  - 5.6

env:
  - WP_PROJECT_TYPE=plugin WP_VERSION=latest WP_MULTISITE=0 WP_TEST_URL=http://localhost:12000 WP_TEST_USER=test WP_TEST_USER_PASS=test

matrix:
  allow_failures:
    - php: nightly

before_script:
  # Install composer packages before trying to activate themes or plugins
  # - composer install

  # Install an older version of PHPUnit as WordPress does not support 8.x yet
  - if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]]; then PHPUNIT_VERSION=5.7.9; else PHPUNIT_VERSION=6.5.9; fi
  - wget https://phar.phpunit.de/phpunit-$PHPUNIT_VERSION.phar -O /tmp/phpunit; chmod +x /tmp/phpunit

  # Install test framework
  - git clone https://github.com/Seravo/wordpress-test-template wp-tests
  - bash wp-tests/bin/install-wp-tests.sh test root '' localhost $WP_VERSION

script:
  - /tmp/phpunit
  - cd wp-tests/spec && bundle exec rspec test.rb
