.travis.yml
language: php
php:
- '7.0'
- '7.1'
cache:
directories:
- $HOME/.composer/cache/files
env:
global:
- CC_TEST_REPORTER_ID=780039b81ab6a07dfc1283aad0af2aba561e02c15958c67500166dc87ae2543f
- SIMPLETEST_DB=sqlite://testdb.sqlite
install:
# We need a full Drupal project for our Kernel tests to work. Create a new project.
- composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction
# Drupal 8.4.x has a bug that doesn't allow Kernel tests to use SQLite. Apply a patch that fixes it.
- patch -d drupal/web -p1 < sqlite-driver-exception.patch
# Our code is no longer in the correct place. Copy it over.
- mkdir -p drupal/web/modules/form_validation && cp -a form_validation* tests src config drupal/web/modules/form_validation
# Update the phpunit.xml.dist file. We want to ignore test coverage for core files.
- patch -d drupal/web/core -p1 < travis-ci-phpunit.xml.dist.patch
before_script:
# Fetch the Code Climate reporter, and prepare for reporting.
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- drupal/vendor/bin/phpunit -c drupal/web/core drupal/web/modules/form_validation/tests/ --coverage-clover ../clover.xml
after_script:
# Submit the test coverage report to Code Climate.
- cd drupal && ../cc-test-reporter after-build -t clover -p "$TRAVIS_BUILD_DIR/drupal" -d --exit-code $TRAVIS_TEST_RESULT