-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_sh
43 lines (33 loc) · 1.15 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
chmod a+w _tests/_output/
[ ! -d "_tests/_output/email/" ] && mkdir _tests/_output/email/
chmod a+w _tests/_output/email/
[ ! -d "_cache/test/" ] && mkdir _cache/test/
chmod a+w _cache/test/
rm -f _cache/*.log
rm -f _cache/test/*.log
# clear test databases
rm -f s2_test
mysql -uroot --execute="DROP DATABASE IF EXISTS s2_test; CREATE DATABASE s2_test;"
echo 'DROP DATABASE IF EXISTS s2_test; CREATE DATABASE s2_test;' | psql postgresql://postgres:12345@localhost > /dev/null
# run web-server in background
APP_ENV=test \
PHP_CLI_SERVER_WORKERS=2 \
nohup php \
-d "max_execution_time=-1" \
-d "opcache.revalidate_freq=0" \
-d "sendmail_path=$(realpath $(dirname "$0")/_tests/_resources/sendmail.php) --dir\\=$(realpath $(dirname "$0")/_tests/_output/email/)" \
-S localhost:8881 >/dev/null 2>&1 &
serverPID=$!
# run tests
if [ -z "$1" ]; then
XDEBUG_MODE=off php _vendor/bin/codecept run acceptance
else
XDEBUG_MODE=off php _vendor/bin/codecept run acceptance "$1"
fi
status=$?
#read -p "Press any key to resume ..."
pkill -P $serverPID # for children PHP_CLI_SERVER_WORKERS
kill $serverPID
rm -f _cache/test/*.php
rm -f _cache/test/*.txt
exit $status