forked from swoft-cloud/swoft-component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpunit.sh
executable file
·58 lines (52 loc) · 1.63 KB
/
phpunit.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
#!/bin/bash
#
# Tool for run unit test for swoft components
#
#binName="sh vi"
binName="./$(basename $0)"
components="component annotation aop bean config connection-pool i18n console db error framework http-message http-server
log proxy redis rpc rpc-client rpc-server server stdlib task tcp-server websocket-server"
if [[ -z "$1" ]] || [[ "$1" == "-h" ]]; then
echo "Use for run phpunit for swoft components."
echo ""
echo "Usage:"
echo " $binName NAME(S) Run phpunit for the given component in the src/NAME"
echo " $binName all Run phpunit for all components at the src/*"
echo ""
echo "Example:"
echo " $binName db Run phpunit for 'db' component"
echo " $binName db event Run phpunit for 'db' and 'event' component"
echo " $binName all"
echo ""
echo "All Components:"
echo " ${components}"
exit
fi
# for one or multi component
if [ "$1" != "all" ]; then
components=$@
fi
echo "Will test components:"
echo ${components}
echo ""
# do run phpunit
# php run.php -c src/annotation/phpunit.xml
# set -ex
for lbName in ${components} ; do
if [ "${lbName}" == "component" ]; then
echo "======> Testing the【component】"
echo "> php run.php -c phpunit.xml"
php run.php -c phpunit.xml
echo $?
else
if [ ! -d "src/${lbName}" ]; then
echo "!! Skip invalid component: ${lbName}"
else
echo "======> Testing the component【${lbName}】"
echo "> php run.php -c src/${lbName}/phpunit.xml"
php run.php -c src/${lbName}/phpunit.xml
echo $?
fi
fi
done
echo "Completed!"