-
Notifications
You must be signed in to change notification settings - Fork 6
/
run_module_tests.sh
executable file
·77 lines (63 loc) · 1.52 KB
/
run_module_tests.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
VERSION=1.0.0
## PLEASE CUSTOMIZE YOURSELF
default_phpunit_active=1
# To active xdebug change variable `off_run_xdebug=` to `run_xdebug=`. Remove `off_`
off_run_xdebug='php -dxdebug.idekey=debugCLI
-dxdebug.remote_host=host.docker.internal
-dxdebug.remote_enable=On
-dxdebug.remote_autostart=On'
# Script can be controlled by environment variables (Nice for Docker)
export PHPUNIT_ACTIVE=${PHPUNIT_ACTIVE:-$default_phpunit_active}
function phpunit {
if [[ PHPUNIT_ACTIVE -eq 1 ]]; then
printf ${yellow}${bold}"[Start PHPUnit]"${reset}"\n"
$PHPCLI ${vendor}/bin/phpunit ./ $*
else
printf ${cyan}"[Skip PHPUnits]"${reset}"\n"
fi
}
#color
export bold="\e[1m"
export yellow="\e[33m"
export cyan="\e[96m"
export cerr="\e[31m"
export reset="\e[0m"
function usage() {
cat <<EOF
Usage: $0 command [argumente]
Bash script to starts any Test Frameworks.
command description
-------------------------
all Start all Tests Frameworks
phpunit Start PHPUnit Frameworks
-h --help Print this help text.
--version Print Version: v$VERSION
EOF
exit 1
}
cd $(dirname $0);
export SCRIPT_DIR=$(pwd -P);
export PHPCLI=${run_xdebug-php}
vendor='../../../../vendor'; #v6.x-Vendor
if [[ ! -d $vendor ]]; then
vendor='../../vendor'; #v4.x-Vendor
fi
function all() {
phpunit;
}
case "$1" in
phpunit)
shift;
phpunit $*
;;
-h|--help)
usage
;;
--version)
echo "v$VERSION"
;;
*)
all
;;
esac