-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntests
executable file
·50 lines (40 loc) · 1.22 KB
/
runtests
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
#!/bin/sh
## Copyright (C) 1997-2018 Reyesoft <info@reyesoft.com>.
## This file is part of a Reyesoft Project. This can not be copied and/or
## distributed without the express permission of Reyesoft
# https://stackoverflow.com/questions/16483119/an-example-of-how-to-use-getopts-in-bash?answertab=votes#tab-top
while getopts ":ft" o; do
case "${o}" in
f)
f=1
;;
t)
t=1
;;
esac
done
php artisan migrate:status --env=testing | grep -E '^\| N|^No migrations' >> /dev/null
if [ "$?" -eq 0 ] || [ "${f}" ] ; then
echo 'Migrations required. Lets do it!'
# ide helper
composer ide-helper &&
php artisan config:clear &&
php artisan migrate:refresh --seed --env=testing &&
if [ $? -ne 0 ]; then
echo "\n ✖ Errors on migrations or generator scripts. \n"
exit 1
fi
## this project
#
else
echo '\033[1;30m Migrations are not required. \033[0m'
fi;
if [ "${t}" ] ; then
phpunit &&
if [ $? -eq 0 ]; then
echo "\n 🔎 Don't forget to run \n composer coverage \n"
fi
else
echo "\n\033[1;33m 💨 For a faster test (only phpunit) run \n sh runtests -t [-f]\n \033[0m"
composer coverage
fi;