-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.xml
107 lines (89 loc) · 3.96 KB
/
build.xml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?xml version="1.0" encoding="UTF-8"?>
<project name="test" description="testing" default="do" >
<!-- unit test properties -->
<property name="test.bootstrap" value="${build.target}/tests/bootstrap.php" />
<property name="test.dir" value="${project.basedir}" />
<property name="test.incpattern" value="**/*Test.php" />
<property name="test.excpattern" value="" />
<property name="test.type" value="xml" />
<property name="test.usefile" value="true" />
<property name="test.haltfail" value="true" />
<property name="test.halterror" value="true" />
<!-- ============================================ -->
<!-- Target: prepare -->
<!-- ============================================ -->
<target name="prepare" >
<available file="${project.basedir}/${build.target}/reports"
property="test.reportsexists"
value="true" />
<if>
<not>
<equals arg1="${test.reportsexist}" arg2="1" />
</not>
<then>
<!-- create required directories -->
<mkdir dir="${project.basedir}/${build.target}/reports" />
</then>
</if>
</target>
<!-- ============================================ -->
<!-- Target: do -->
<!-- ============================================ -->
<target name="do" depends="test.prepare" >
<!-- create a test bootstrap if one doesnt exist -->
<if>
<not>
<available file="${test.bootstrap}" property="bootstrapexists" />
</not>
<then>
<echo file="${test.bootstrap}"
msg="<?php${line.separator}" />
<echo file="${test.bootstrap}"
msg="#Unit Test Boostrap${line.separator}"
append="true" />
<echo file="${test.bootstrap}"
msg="?>${line.separator}"
append="true" />
</then>
</if>
<!-- set the application environment if designated by the command -->
<if>
<isset property="test.env" />
<then>
<echo msg="PHPUnit is testing against ${test.env} per request" />
<available file="${test.bootstrap}" property="envbootstrapexists" value="Yes"/>
<if>
<not>
<equals arg1="${envbootstrapexists}" arg2="1" />
</not>
<then>
<echo file="${build.target}/tests/bootstrap.${test.env}.php" >
<?php
putenv('APPLICATION_ENV=${test.env}');
include('${test.bootstrap}');
</echo>
<property name="test.bootstrap"
value="${build.target}/tests/bootstrap.${test.env}.php"
override="true" />
</then>
</if>
</then>
</if>
<!-- run unit test -->
<phpunit bootstrap="${test.bootstrap}"
printsummary="true"
haltonfailure="${test.haltfail}"
haltonerror="${test.halterror}" >
<formatter todir="${project.basedir}/${build.target}/reports"
type="${test.type}"
usefile="${test.usefile}" />
<formatter type="plain" usefile="no" />
<batchtest>
<fileset dir="${test.dir}">
<include name="${test.incpattern}"/>
<exclude name="${test.excpattern}"/>
</fileset>
</batchtest>
</phpunit>
</target>
</project>