File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 " codesniffer-run" ,
2323 " composer-install" ,
2424 " coverage-ensure" ,
25+ " coverage-report" ,
2526 " db-backup" ,
2627 " db-credentials" ,
2728 " db-login" ,
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # ---------------------------------------------------------------------
4+ usage ()
5+ {
6+ cat << EOT
7+
8+ ${0##*/ }
9+ Convenience wrapper to execute phpunit test suite, generate
10+ html coverage and open it in your browser (if you're on a Mac.)
11+
12+ Should be run from the project root folder.
13+
14+ Usage:
15+ bin/${0##*/ }
16+
17+
18+ EOT
19+
20+ exit ${1:- 0} # Exit with code 0 unless an arg is passed to the method.
21+ }
22+ if [ " $1 " = ' -h' ]; then
23+ usage
24+ fi
25+
26+
27+ DIR=" $( cd -P " $( dirname " $0 " ) " /.. > /dev/null 2>&1 && pwd ) "
28+ COVERAGE_PATH=" tmp/coverage/html/"
29+
30+
31+ # Launch the coverage in a browser if requested and we're on the host.
32+ if command -v ' open' > /dev/null 2>&1 ; then
33+ bin/vagrant-exec " vendor/bin/phpunit --coverage-html=" $COVERAGE_PATH " "
34+ open " ${COVERAGE_PATH} index.html"
35+ else
36+ cd " $DIR "
37+ bin/phpunit --coverage-html=" $COVERAGE_PATH "
38+ echo " "
39+ echo " ## Run 'open ${COVERAGE_PATH} index.html'"
40+ echo " ## from your host to view coverage reports in a browser."
41+ echo " "
42+ fi
You can’t perform that action at this time.
0 commit comments