summaryrefslogtreecommitdiff
path: root/tests/phpunit/Makefile
blob: a33b86a353e764e1582bedb214912ce028f8c25b (plain)
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
78
79
80
81
82
83
84
85
86
87
88
.PHONY: help test phpunit coverage warning destructive parser noparser safe databaseless list-groups
.DEFAULT: warning

SHELL = /bin/sh
CONFIG_FILE = ${PWD}/suite.xml
PHP = php
PU = ${PHP} phpunit.php --configuration ${CONFIG_FILE} ${FLAGS}

all test: warning

warning:
	@echo "Run 'make help' to get usage"
	@echo ""
	@echo "WARNING -- some tests are DESTRUCTIVE and will alter your wiki."
	@echo "DO NOT RUN THESE TESTS on a production wiki."
	@echo ""
	@echo "Until the default tests are made non-destructive, you can run"
	@echo "the destructive tests like so:"
	@echo ""
	@echo "    make destructive"
	@echo ""
	@echo "Some tests are expected to be safe, you can run them with"
	@echo ""
	@echo "    make safe"
	@echo ""
	@echo "You are recommended to run the tests with read-only credentials."
	@echo ""
	@echo "If you don't have a database running, you can still run"
	@echo ""
	@echo "    make databaseless"
	@echo ""

destructive: phpunit

phpunit:
	${PU}

tap:
	${PU} --tap

coverage:
	${PU} --coverage-html ../../docs/code-coverage

parser:
	${PU} --group Parser
parserfuzz:
	@echo "******************************************************************"
	@echo "* This WILL kill your computer by eating all memory AND all swap *"
	@echo "*                                                                *"
	@echo "* If you are on a production machine. ABORT NOW!!                *"
	@echo "*  Press control+C to stop                                       *"
	@echo "*                                                                *"
	@echo "******************************************************************"
	${PU} --group Parser,ParserFuzz
noparser:
	${PU} --exclude-group Parser,Broken,ParserFuzz,Stub

safe:
	${PU} --exclude-group Broken,ParserFuzz,Destructive,Stub

databaseless:
	${PU} --exclude-group Broken,ParserFuzz,Destructive,Database,Stub

database:
	${PU} --exclude-group Broken,ParserFuzz,Destructive,Stub --group Database

list-groups:
	${PU} --list-groups

help:
	# Usage:
	#   make <target> [OPTION=value]
	#
	# Targets:
	#   phpunit (default)   Run all the tests with phpunit
	#   install             Install PHPUnit from phpunit.de
	#   tap                 Run the tests individually through Test::Harness's prove(1)
	#   help                You're looking at it!
	#   coverage            Run the tests and generates an HTML code coverage report
	#                       You will need the Xdebug PHP extension for the later.
	#   [no]parser          Skip or only run Parser tests
	#
	#   list-groups         List available Tests groups.
	#
	#  Options:
	#   CONFIG_FILE         Path to a PHPUnit configuration file (default: suite.xml)
	#   FLAGS               Additional flags to pass to PHPUnit
	#   PHP                 Path to php