woocommerce/tests/bin/travis.sh

37 lines
767 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2017-09-26 13:09:27 +00:00
# usage: travis.sh before|during|after
if [ $1 == 'before' ]; then
2016-09-13 23:55:58 +00:00
# Composer install fails in PHP 5.2
[[ ${TRAVIS_PHP_VERSION} == '5.2' ]] && exit;
2016-09-13 23:55:58 +00:00
# No Xdebug and therefore no coverage in PHP 5.3
[[ ${TRAVIS_PHP_VERSION} == '5.3' ]] && exit;
2016-09-13 23:55:58 +00:00
2017-07-20 14:55:45 +00:00
if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then
2017-03-14 17:17:35 +00:00
composer global require "phpunit/phpunit=4.8.*"
2017-07-20 14:55:45 +00:00
else
2017-07-20 16:32:21 +00:00
composer global require "phpunit/phpunit=6.2.*"
2017-03-14 17:17:35 +00:00
fi
fi
2017-09-26 12:24:11 +00:00
2017-09-26 13:09:27 +00:00
if [ $1 == 'during' ]; then
2017-09-26 12:24:11 +00:00
2017-09-26 13:38:50 +00:00
if [[ ${TRAVIS_PHP_VERSION} == ${PHP_LATEST_STABLE} ]]; then
2017-09-26 13:09:27 +00:00
phpunit -c phpunit.xml --coverage-clover=coverage.clover
else
phpunit -c phpunit.xml
fi
2017-09-26 12:24:11 +00:00
2017-09-26 13:09:27 +00:00
fi
2017-09-26 12:24:11 +00:00
2017-09-26 13:09:27 +00:00
if [ $1 == 'after' ]; then
2017-09-26 13:38:50 +00:00
if [[ ${TRAVIS_PHP_VERSION} == ${PHP_LATEST_STABLE} ]]; then
2017-09-26 13:09:27 +00:00
bash <(curl -s https://codecov.io/bash)
2017-09-26 12:24:11 +00:00
fi
fi