Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bin/test helper scripts to execute unit tests #1157

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions compose/bin/test/unit
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

display_help() {
echo -e "Description:
Run unit tests

Usage:
bin/test/unit <unit_test_path>

Arguments:
<unit_test_path> Specify a path to your test or folder with tests Ex: bin/test/unit app/code/Vendor/Module

Options:
-h, --help Display help message"
}


if [[ $1 == "-h" || $1 == "--help" ]]; then
display_help
elif [[ -z $1 ]]; then
echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)"
else
bin/php vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/"$1"
fi
24 changes: 24 additions & 0 deletions compose/bin/test/unit-coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

display_help() {
echo -e "Description:
Generate unit tests coverage report in folder: dev/tests/unit/report

Usage:
bin/test/unit-coverage <unit_test_path>

Arguments:
<unit_test_path> Specify a path to your test or folder with tests Ex: bin/test/unit-coverage app/code/Vendor/Module

Options:
-h, --help Display help message"
}

if [[ $1 == "-h" || $1 == "--help" ]]; then
display_help
elif [[ -z $1 ]]; then
echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)"
else
bin/php -d xdebug.mode=coverage vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist --coverage-html ./dev/tests/unit/report /var/www/html/"$1"
echo -e "Report path: dev/tests/unit/report"
fi
24 changes: 24 additions & 0 deletions compose/bin/test/unit-xdebug
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

display_help() {
echo -e "Description:
Run unit tests with xdebug (you need to turn on xdebug in IDE as usual)

Usage:
bin/test/unit-xdebug <unit_test_path>

Arguments:
<unit_test_path> Specify a path to your test or folder with tests Ex: bin/test/unit-xdebug app/code/Vendor/Module

Options:
-h, --help Display help message"
}


if [[ $1 == "-h" || $1 == "--help" ]]; then
display_help
elif [[ -z $1 ]]; then
echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)"
else
bin/php -d xdebug.start_with_request=yes vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist /var/www/html/"$1"
fi