-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.sh
executable file
·81 lines (59 loc) · 1.64 KB
/
test.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
78
79
80
81
#!/bin/bash
# Set of basic tests to ensure minimum hygene.
set -e
set -u
# set -x
# Preparing for nice and colourful output
export TERM=xterm-256color
CRED=$(tput setaf 160)
CGRN=$(tput setaf 28)
CRES=$(tput sgr0)
function run()
{
docker run -rm -i -t \
--volume ${PWD}/test:/test:r \
--workdir /test \
darh/php-essentials $@
}
function report()
{
if [ "$1" -eq 0 ]; then
echo -n "${CGRN} ✓ "
else
echo -n "${CRED} ✘ "
fi;
echo "${2}${CRES}"
}
# Basic CLI PHP
run php -f hello.php |grep 'Hello world' &>> debug.log
report $? "php"
# Server
CID=$(docker run -d --publish 64001:64001 \
--volume ${PWD}/test:/test:r \
--workdir /test \
darh/php-essentials php -S 0.0.0.0:64001);
report $? "php server started"
wget -q -O - http://localhost:64001/hello.php|grep 'Hello world' &>> debug.log
report $? "php server responded"
(docker stop $CID && docker rm $CID) &>> debug.log
report $? "php server stoped & removed"
# Tools:
run composer|grep '\[options\] command \[arguments\]' &>> debug.log
report $? "composer"
run pear version|grep "PEAR Version" &>> debug.log
report $? "pear"
run phpunit --version|head -n1|grep "Bergman" &>> debug.log
report $? "phpunit"
run phpcpd --version|head -n1|grep "Bergman" &>> debug.log
report $? "phpcpd"
run phpdcd --version|head -n1|grep "Bergman" &>> debug.log
report $? "phpdcd"
run pdepend --version|head -n1|grep "Pichler" &>> debug.log
report $? "pdepend"
run phpmd --version|head -n1|grep "Pichler" &>> debug.log
report $? "phpmd"
run phpcs --version|head -n1|grep "Squiz" &>> debug.log
report $? "phpcs"
run behat --version|head -n1|grep "Behat" &>> debug.log
report $? "behat"
rm debug.log