forked from contao/contao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·104 lines (91 loc) · 2.02 KB
/
run
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
function phpunit() {
if [[ ! -e ./vendor/bin/phpunit ]]; then
echo "The vendor/bin/phpunit file is missing. Did you install the dependencies?"
exit 1
fi
local bundles=(
calendar-bundle
core-bundle
faq-bundle
installation-bundle
manager-bundle
news-bundle
)
for bundle in ${bundles[*]}; do
vendor/bin/phpunit -c ${bundle} "$@"
done
}
function functional() {
if [[ ! -e ./vendor/bin/phpunit ]]; then
echo "The vendor/bin/phpunit file is missing. Did you install the dependencies?"
exit 1
fi
vendor/bin/phpunit -c core-bundle --testsuite=functional "$@"
}
function php-cs-fixer() {
if [[ ! -e ./vendor/bin/php-cs-fixer ]]; then
echo "The vendor/bin/php-cs-fixer file is missing. Did you install the dependencies?"
exit 1
fi
vendor/bin/php-cs-fixer fix -v "$@"
vendor/bin/php-cs-fixer fix -v --config .php_cs.legacy "$@"
}
function phpstan() {
if [[ ! -e ./vendor/bin/phpstan ]]; then
echo "The vendor/bin/phpstan file is missing. Did you install the dependencies?"
exit 1
fi
vendor/bin/phpstan analyze core-bundle/src core-bundle/tests --level=3
}
function composer() {
if [[ ! -e ./vendor/bin/monorepo-tools ]]; then
echo "The vendor/bin/monorepo-tools file is missing. Did you install the dependencies?"
exit 1
fi
vendor/bin/monorepo-tools composer --validate
}
function usage() {
cat <<HEREDOC
Usage: ./run [task]
phpunit Run the unit tests
functional Run the functional tests
php-cs-fixer Run the PHP coding style fixer
phpstan Run the static PHP analyzer
composer Validate the composer.json files
HEREDOC
}
case "$1" in
phpunit)
phpunit "${@:2}"
exit 0
;;
functional)
functional
exit 0
;;
php-cs-fixer)
php-cs-fixer "${@:2}"
exit 0
;;
phpstan)
phpstan
exit 0
;;
composer)
composer
exit 0
;;
all)
phpunit "${@:2}"
functional
php-cs-fixer "${@:2}"
phpstan
composer
exit 0
;;
*)
usage
exit 1
;;
esac