#
# Travis CI configuration file
#

# Use Travis CI's Docker infrastructure.
sudo: false

# Tell Travis CI that this is a PHP project.
language: php

# Versions of PHP to test against.
php:
    - 5.4
    - 5.5
    - 5.6
    - 7.0

# Specify what version of WordPress to test with.
# WP_VERSION: Any valid git branch or tag from github.com/WordPress/WordPress
env:
    - WP_VERSION=4.1-branch

# Install WordPress and test support files.
install:
    # Where to install WordPress.
    - export WP_CORE_DIR=/tmp/wordpress

    # Grab specified version of WordPress from github
    - wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION
    - mkdir -p $WP_CORE_DIR
    - tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR

    # Put various components in proper folders
    - build_dir=$(basename $(pwd))
    - plugin_dir=$WP_CORE_DIR/wp-content/plugins/drupal-password-encryption
    - cd ..
    - mv $build_dir $plugin_dir

    # Install and configure the test suite boilerplate.
    - cd $WP_CORE_DIR
    - git clone --depth=1 https://github.com/BevanR/Test-suite-boilerplate-for-WordPress-websites.git test
    - mv $plugin_dir/.travis/wp-tests-config.local.php test/phpunit/
    # The boilerplate repository's default phpunit.xml is already configured for drupal-password-encryption plugin.
    - mv test/phpunit/phpunit-sample.xml phpunit.xml

    # Init the database.
    - mysql -e 'CREATE DATABASE wordpress_test;' -uroot
