diff --git a/bin/check-src-test-coverage.sh b/bin/check-src-test-coverage.sh index 4c4cc86e6a9..5e002c3f5ba 100755 --- a/bin/check-src-test-coverage.sh +++ b/bin/check-src-test-coverage.sh @@ -10,6 +10,7 @@ docker-compose exec -u www-data wordpress \ echo "Checking coverage..." docker-compose exec -u www-data wordpress \ + php -d xdebug.remote_autostart=on \ /var/www/html/wp-content/plugins/woocommerce-payments/vendor/bin/phpunit \ --configuration /var/www/html/wp-content/plugins/woocommerce-payments/phpunit-src.xml.dist \ --coverage-html /var/www/html/php-test-coverage \ diff --git a/bin/check-test-coverage.sh b/bin/check-test-coverage.sh index e4bf6651134..ba8e6ef8b17 100755 --- a/bin/check-test-coverage.sh +++ b/bin/check-test-coverage.sh @@ -2,6 +2,14 @@ set -e +if [ "$1" == "src" ]; then + CONFIGURATION_FILE=phpunit-src.xml.dist + COVERAGE=100 +else + CONFIGURATION_FILE=phpunit.xml.dist + COVERAGE=60 +fi + echo "Installing the test environment..." docker-compose exec -u www-data wordpress \ @@ -12,6 +20,8 @@ echo "Checking coverage..." docker-compose exec -u www-data wordpress \ php -d xdebug.remote_autostart=on \ /var/www/html/wp-content/plugins/woocommerce-payments/vendor/bin/phpunit \ - --configuration /var/www/html/wp-content/plugins/woocommerce-payments/phpunit.xml.dist \ - --coverage-html /var/www/html/php-test-coverage - $* + --configuration "/var/www/html/wp-content/plugins/woocommerce-payments/$CONFIGURATION_FILE" \ + --coverage-html /var/www/html/php-test-coverage \ + --coverage-clover /var/www/html/clover.xml + +./vendor/bin/coverage-check docker/wordpress/clover.xml $COVERAGE diff --git a/package.json b/package.json index c1587abd83d..2f90d762764 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "test:update-snapshots": "npm run test:js -- --updateSnapshot", "test:php": "./bin/run-tests.sh", "test:php-coverage": "./bin/check-test-coverage.sh", - "test:php-coverage-src": "./bin/check-src-test-coverage.sh", + "test:php-coverage-src": "./bin/check-test-coverage.sh src", "test:php-watch": "npm run test:php -- -w", "test:qit": "npm run build:release && ./tests/qit/security.sh", "watch": "webpack --watch",