-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverage-report
More file actions
executable file
·40 lines (29 loc) · 934 Bytes
/
coverage-report
File metadata and controls
executable file
·40 lines (29 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
#---------------------------------------------------------------------
usage ()
{
cat <<EOT
${0##*/}
Convenience wrapper to execute phpunit test suite, generate
html coverage and open it in your browser (if you're on a Mac.)
Should be run from the project root folder.
Usage:
bin/${0##*/}
EOT
exit ${1:-0} # Exit with code 0 unless an arg is passed to the method.
}
if [ "$1" = '-h' ]; then
usage
fi
COVERAGE_PATH="tmp/coverage/html"
# Launch the coverage in a browser if we're on the host.
if command -v 'open' >/dev/null 2>&1 && command -v 'vagrant' >/dev/null 2>&1; then
bin/vagrant-exec "bin/phpunit --coverage-html="$COVERAGE_PATH""
open "${COVERAGE_PATH}/index.html"
else
bin/phpunit --coverage-html="$COVERAGE_PATH"
echo ""
echo "## Run 'open ${COVERAGE_PATH}/index.html'"
echo "## from your host to view coverage reports in a browser."
echo ""
fi