--- /dev/null
+language: php
+
+php:
+ - 5.5
+ - 5.6
+ - 7.0
+
+env:
+ global:
+ - PATH=$PATH:/home/travis/.composer/vendor/bin
+ - TRAVIS_NODE_VERSION="4.0.0"
+ matrix:
+ - DRUPAL_VERSION=6
+ - DRUPAL_VERSION=7
+ - DRUPAL_VERSION=8
+
+matrix:
+ exclude:
+ - php: 5.6
+ env: DRUPAL_VERSION=6
+ - php: 7.0
+ env: DRUPAL_VERSION=6
+ allow_failures:
+ - php: 7.0
+ env: DRUPAL_VERSION=7
+ - php: 5.3
+
+# Enable Travis containers.
+sudo: false
+
+install:
+ - composer self-update
+ # Use the example composer.json file for Drupal 8, and also install the behat drush endpoint.
+ - test ${DRUPAL_VERSION} -ne 8 || (cp doc/_static/composer.json.d8 ./composer.json && composer require --prefer-source drush-ops/behat-drush-endpoint drupal/drupal-driver:dev-master)
+ - composer install
+ # Install drush.
+ - composer global require drush/drush:~8.0
+ # Install the Behat Drush Endpoint for Drupal 7 tests.
+ - test ${DRUPAL_VERSION} -ne 7 || (git clone https://github.com/drush-ops/behat-drush-endpoint.git drush/behat-drush-endpoint && (cd drush/behat-drush-endpoint && composer install))
+ # Pin node version.
+ # @see http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
+ - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
+ - npm install
+
+before_script:
+ # Set NODE_PATH for zombie driver.
+ - export NODE_PATH="`pwd`/node_modules"
+ # Define the module path according to the Drupal version being tested.
+ - test ${DRUPAL_VERSION} -eq 8 && export MODULE_PATH='drupal/modules' || export MODULE_PATH='drupal/sites/all/modules'
+ # Drupal 8 uses semantic versioning.
+ - test ${DRUPAL_VERSION} -eq 8 && export PROJECT_NAME='drupal-8.1.x' || export PROJECT_NAME="drupal-${DRUPAL_VERSION}.x"
+ # Set sendmail so drush doesn't throw an error during site install.
+ - echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
+ # Download and install Drupal so we can test API abilities.
+ - mysql -e 'create database drupal'
+ - drush --quiet dl ${PROJECT_NAME} --all --drupal-project-rename=drupal
+ - drush --yes --root=$PWD/drupal site-install --db-url=mysql://travis:@127.0.0.1/drupal
+ # Copy the static HTML that is used for blackbox testing in the web root.
+ - cp -r fixtures/blackbox $PWD/drupal
+ # Copy our test module to the correct location.
+ - cp -r fixtures/drupal${DRUPAL_VERSION}/modules/behat_test ${MODULE_PATH}
+ - cd drupal
+ - drush --yes en behat_test
+ - drush cc drush
+ - test ${DRUPAL_VERSION} -eq 6 || drush help behat
+ # Only revert features on Drupal 7.
+ - test \! ${DRUPAL_VERSION} -eq 7 || drush --yes fr behat_test
+ # Disable the page cache on Drupal 8.
+ - test \! ${DRUPAL_VERSION} -eq 8 || drush --yes pmu page_cache
+ # Test with big_pipe enabled for Drupal 8.
+ - test \! ${DRUPAL_VERSION} -eq 8 || drush --yes en -y big_pipe
+ # Clear the cache on Drupal 6 and 7, rebuild on Drupal 8.
+ - test ${DRUPAL_VERSION} -eq 8 && drush cr || drush cc all || true
+ - drush --debug runserver :8888 > ~/debug.txt 2>&1 &
+ - cd -
+ - sleep 4s
+
+script:
+ - find ./src -name "*.php" -print0 | xargs -0 -n1 -P8 php -l
+ - vendor/bin/phpspec run -f pretty --no-interaction
+ - vendor/bin/behat -fprogress --strict
+ - vendor/bin/behat -fprogress --profile=drupal${DRUPAL_VERSION} --strict
+ # Do not test the Drush profile unless Drupal 7 was installed.
+ - test ${DRUPAL_VERSION} -ne 7 || vendor/bin/behat -fprogress --profile=drush --strict
+
+after_failure:
+ - cat ~/debug.txt