Skip to content

Commit

Permalink
Using a single local bash file
Browse files Browse the repository at this point in the history
  • Loading branch information
RadoslavGeorgiev committed Oct 26, 2023
1 parent b94ccdf commit b2c0f8b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions bin/check-src-test-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
16 changes: 13 additions & 3 deletions bin/check-test-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b2c0f8b

Please sign in to comment.