forked from JKershaw/RDTOM-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests
executable file
·76 lines (56 loc) · 1.55 KB
/
run_tests
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
set -e
if [ $# -gt 0 ]; then
echo "======================================="
git pull
fi
echo "======================================="
echo "Running unit tests"
php codecept.phar run unit --steps
echo "======================================="
echo "Starting PhantomJS"
if [[ $(lsof -i:4444 | grep phantomjs) != "" ]]
then
echo "PhantomJS is already running"
lsof -i:4444 | grep phantomjs
else
echo "PhantomJS not currently running"
phantomjs --webdriver=4444 &
while [[ $(lsof -i:4444 | grep phantomjs) == "" ]]
do
sleep 1
echo "."
done
fi
echo "======================================="
echo "Setting up server"
sudo a2enmod rewrite
sudo a2enmod headers
sudo rm -rf /etc/apache2/sites-available/rdtom.conf
sudo a2dissite rdtom || true
sudo cp tests/config/rdtom.conf /etc/apache2/sites-available
sudo a2ensite rdtom
sudo service apache2 restart
sudo service mysql restart
# clear the database
echo "======================================="
echo "Dropping the database"
mysql -u root -e "drop database circle_test" || true
echo "Creating new database"
mysql -u root -e "create database circle_test"
echo "Populating database"
mysql -u root circle_test < tests/_data/dump.sql
echo "======================================="
#php codecept.phar run api --steps --fail-fast
php codecept.phar run acceptance --steps --fail-fast
#./show_output
sudo service apache2 stop
if [ $# -gt 0 ]; then
MESSAGE="$@"
echo "Committing with message '$MESSAGE'"
git pull
git add -A
git commit -am "$MESSAGE"
git push
else
echo "No commit message, no commit"
fi