forked from antidot/PHP_API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules.mk
68 lines (53 loc) · 1.81 KB
/
rules.mk
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
#*******************************************************************************
#
# AFS © Antidot 2014
#
#*******************************************************************************
.PHONY: all_tests test individual_tests test_coverage
.PHONY: local_test local_individual_tests recurse
TEST_DIR=$(filter %/TEST, $(CURDIR))
all_tests: test individual_tests
test: local_test recurse
individual_tests: local_individual_tests recurse
local_test:
@if [ -f $(which phpunit) ]; \
then \
if [ "${TEST_DIR}" != "" ]; \
then \
phpunit -d display_errors=1 -d display_startup_errors=1 -d error_reporting=-1 --stop-on-failure --stderr --include-path $(ROOT_PATH) $(CURDIR) || exit 1; \
fi; \
else \
echo 'You need phpunit installed on your computer to run unit tests'; \
fi
local_individual_tests:
@if [ -f $(which phpunit) ]; \
then \
if [ "${TEST_DIR}" != "" ]; \
then \
for file in $$(ls *.php); \
do \
echo "\n=============================================="; \
echo ">>>> Running tests for $${file} <<<<"; \
echo "=============================================="; \
phpunit --stop-on-failure --stderr --include-path $(ROOT_PATH) $${file} || exit 1; \
done; \
fi; \
else \
echo 'You need phpunit installed on your computer to run unit tests'; \
fi
test_coverage:
@if [ -f $(which phpunit) ]; \
then \
rm -rf $(ROOT_PATH)/coverage; \
phpunit -d display_errors=1 -d display_startup_errors=1 -d error_reporting=-1 --coverage-html=$(ROOT_PATH)/coverage --stop-on-failure --stderr --include-path $(ROOT_PATH) $(ROOT_PATH) || exit 1; \
else \
echo 'You need phpunit installed on your computer to run unit tests'; \
fi
recurse:
@for DIR in $$(ls -d */ 2> /dev/null); \
do \
if [ -f "$${DIR}/Makefile" ]; \
then \
$(MAKE) -C $${DIR} $(MAKECMDGOALS) || exit 1; \
fi; \
done