-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.sh
executable file
·77 lines (60 loc) · 1.51 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
#!/bin/bash -x
#
# OpenTHC Test Runner
#
set -o errexit
set -o nounset
x=${OPENTHC_TEST_BASE:-}
if [ -z "$x" ]
then
echo "You have to define the environment first"
exit 1
fi
f=$(readlink -f "$0")
d=$(dirname "$f")
cd "$d"
declare -rx OUTPUT_BASE="webroot/test-output"
declare -rx OUTPUT_MAIN="${OUTPUT_BASE}/index.html"
declare -rx SOURCE_LIST="lib/ test/"
mkdir -p "${OUTPUT_BASE}"
#
# Lint
vendor/openthc/common/test/phplint.sh
#
# PHP-CPD
vendor/openthc/common/test/phpcpd.sh
#
# PHPStan
vendor/openthc/common/test/phpstan.sh
#
# PHPUnit
vendor/openthc/common/test/phpunit.sh "$@"
#
# Final Output
test_date=$(date)
test_note=$(tail -n1 "${OUTPUT_BASE}/phpunit.txt")
cat <<HTML > "${OUTPUT_MAIN}"
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, user-scalable=yes">
<meta name="theme-color" content="#069420">
<style>
html {
font-family: sans-serif;
font-size: 1.5rem;
}
</style>
<title>Test Result ${test_date}</title>
</head>
<body>
<h1>Test Result ${test_date}</h1>
<h2>${test_note}</h2>
<p>Linting: <a href="phplint.txt">phplint.txt</a></p>
<p>PHPCPD: <a href="phpcpd.txt">phpcpd.txt</a></p>
<p>PHPStan: <a href="phpstan.xml">phpstan.xml</a> and <a href="phpstan.html">phpstan.html</a></p>
<p>PHPUnit: <a href="phpunit.txt">phpunit.txt</a>, <a href="phpunit.xml">phpunit.xml</a> and <a href="phpunit.html">phpunit.html</a></p>
<p>Textdox: <a href="testdox.txt">testdox.txt</a>, <a href="testdox.xml">testdox.xml</a> and <a href="testdox.html">testdox.html</a></p>
</body>
</html>
HTML