This repository has been archived by the owner on Feb 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtests.xml
288 lines (273 loc) · 17.3 KB
/
tests.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<?xml version="1.0" encoding="UTF-8"?>
<project name="phptools" basedir=".">
<dirname property="phptools.basedir" file="${ant.file.phptools}"/>
<target name="tools-init-fallback" unless="phptools.properties">
<property name="phptools.file" value="php-build-tools.properties"/>
<property name="phptools.properties" location="${phptools.basedir}/${phptools.file}"/>
</target>
<target name="tools-init" depends="tools-init-fallback">
<property file="${phptools.properties}"/>
<echo message="using php tools properties from ${phptools.properties}" level="verbose"/>
<!-- Use a timestamp to avoid collisions between builds of the same project -->
<tstamp>
<format property="phptools.properties.time" pattern="yyyyMMdd_HHmmss" />
</tstamp>
<property name="phptools.properties.filter" location="${phptools.properties.tmp}-${phptools.properties.time}" />
<echoproperties destfile="${phptools.properties.filter}" prefix="phptools."/>
<echo message="Expanded properties put into ${phptools.properties.filter}" level="verbose"/>
</target>
<target name="phptests" depends="phptests-parallel, phptests-serial"
description="Entry point for php tests."/>
<target name="phptests-serial" depends="tools-init, lint" unless="${phptools.parallel}"
description="Run PHP tools in serial (after lint)">
<echo message="Running PHP tools in serial mode" level="verbose"/>
<antcall target="phptools.phpunit"/>
<antcall target="phptools.behat"/>
<antcall target="phptools.phpspec2" />
<antcall target="phptools.phpmd-ci" />
<antcall target="phptools.pdepend" />
<antcall target="phptools.phpcpd" />
<antcall target="phptools.phpcb" />
<antcall target="phptools.phpcs-ci" />
<antcall target="phptools.phploc" />
<echo message="tools complete, generating documentation" level="verbose"/>
<antcall target="phptools.phpdox" />
</target>
<target name="phptests-parallel" depends="tools-init, lint" if="${phptools.parallel}"
description="Run PHP tools in parallel (after lint)">
<echo message="Running PHP tools in parallel mode" level="verbose"/>
<parallel threadCount="${phptools.threadcount}">
<antcall target="phptools.phpunit"/>
<antcall target="phptools.behat"/>
<antcall target="phptools.phpspec2" />
<antcall target="phptools.phpmd-ci" />
<antcall target="phptools.pdepend" />
<antcall target="phptools.phpcpd" />
<antcall target="phptools.phpcb" />
<antcall target="phptools.phpcs-ci" />
<antcall target="phptools.phploc" />
</parallel>
<echo message="tools complete, generating documentation" level="verbose"/>
<antcall target="phptools.phpdox" />
</target>
<target name="phpunit.exists" unless="phptools.phpunit.run" description="check if phpunit exists" depends="tools-init">
<available property="phptools.phpunit.run" file="${phptools.phpunit.phar}" />
<available property="phptools.phpunit.bootstrap.nocopy" file="${phptools.phpunit.bootstrap}" />
<available property="phptools.phpunit.config.nocopy" file="${phptools.phpunit.config}" />
</target>
<target name="phpunit.bootstrap.copy" if="phptools.phpunit.run" unless="phptools.phpunit.bootstrap.nocopy"
description="Copy a phpunit config file with sensible defaults if none exists">
<echo message="Copying ${phptools.phpunit.dist.bootstrap} to ${phptools.phpunit.bootstrap}" level="verbose" />
<copy file="${phptools.phpunit.dist.bootstrap}" tofile="${phptools.phpunit.bootstrap}" overwrite="false" filtering="true">
<filterset filtersfile="${phptools.properties.filter}"/>
</copy>
</target>
<target name="phpunit.config.copy" if="phptools.phpunit.run" unless="phptools.phpunit.config.nocopy"
description="Copy a phpunit config file with sensible defaults if none exists">
<echo message="Copying ${phptools.phpunit.dist.config} to ${phptools.phpunit.config}" level="verbose" />
<copy file="${phptools.phpunit.dist.config}" tofile="${phptools.phpunit.config}" overwrite="false" filtering="true">
<filterset filtersfile="${phptools.properties.filter}"/>
</copy>
</target>
<target name="phpunit" depends="tools-init, phpunit.exists, phpunit.bootstrap.copy, phpunit.config.copy" if="${phptools.phpunit.run}"
description="Run unit tests with PHPUnit">
<echo message="Running PHPUnit tests" level="${phptools.phpunit.echolevel}" />
<exec dir="${phptools.builddir}" executable="${phptools.phpunit.phar}" failonerror="${phptools.phpunit.failonerror}">
<arg value="--configuration" />
<arg value="${phptools.phpunit.config}" />
<arg path="${phptools.phpunit.testdir}" />
</exec>
<echo message="PHPUnit complete" level="${phptools.phpunit.echolevel}" />
</target>
<!-- Run Behat tests (http://behat.org/) -->
<target name="behat.exists" unless="phptools.behat.run">
<available property="phptools.behat.run" file="${phptools.behat.phar}" />
<available property="phptools.behat.config.nocopy" file="${phptools.behat.config}" />
</target>
<target name="behat.config.copy" if="phptools.behat.run" unless="phptools.behat.config.nocopy"
description="Copy a behat config file with sensible defaults if none exists">
<echo message="Copying ${phptools.behat.dist.config} to ${phptools.behat.config}" level="${phptools.behat.echolevel}" />
<copy file="${phptools.behat.dist.config}" tofile="${phptools.behat.config}" overwrite="false" filtering="true">
<filterset filtersfile="${phptools.properties.filter}"/>
</copy>
</target>
<target name="behat" depends="tools-init, behat.exists, behat.config.copy" if="${phptools.behat.run}" description="Calculate software metrics using PHP_Depend">
<echo message="Behat found, running BDD tests" level="${phptools.behat.echolevel}" />
<exec dir="${phptools.builddir}" executable="${phptools.behat.phar}" failonerror="${phptools.behat.failonerror}">
<arg value="--config" />
<arg value="${phptools.behat.config}" />
<arg value="-f" />
<arg value="${phptools.behat.format}" />
<arg value="--out" />
<arg value="${phptools.behat.report}" />
<arg path="${phptools.behat.srcdir}" />
</exec>
<echo message="BDD tests complete" level="${phptools.behat.echolevel}" />
</target>
<!-- Run phpspec (http://phpspec.net/) Specification BDD tests -->
<target name="phpspec2.exists" unless="phpspec2.run">
<available property="phptools.phpspec2.run" file="${phptools.phpspec2.phar}" />
</target>
<target name="phpspec2" depends="tools-init, phpspec2.exists" if="${phptools.phpspec2.run}" description="Calculate software metrics using PHP_Depend">
<echo message="PHPSpec2 found, running spec tests" level="${phptools.phpspec2.echolevel}"/>
<exec executable="${phptools.phpspec2.phar}" failonerror="${phptools.phpspec2.failonerror}">
<redirector output="${phptools.phpspec2.log}" alwayslog="true"/>
<arg value="run" />
<arg value="--no-interaction" />
<arg value="--no-code-generation" />
<arg value="--format=junit" />
<arg path="${phptools.phpspec2.specs}" />
</exec>
<echo message="Spec tests complete" level="${phptools.phpspec2.echolevel}" />
</target>
<!-- Generate API documentation -->
<target name="phpdox.exists" unless="phptools.phpdox.run" description="Test that the phpdox phar is available"
depends="tools-init">
<available property="phptools.phpdox.run" file="${phptools.phpdox.phar}" />
<available property="phptools.phpdox.config.nocopy" file="${phptools.phpdox.config}" />
</target>
<target name="phpdox.copy" if="phptools.phpdox.run" unless="phptools.phpdox.config.nocopy"
description="Copy a phpDox config file with sensible defaults if none exists">
<echo message="No existing phpDox config found, copying ${phptools.phpdox.dist} to ${phptools.phpdox.config}"
level="${phptools.phpdox.echolevel}" />
<copy file="${phptools.phpdox.dist}" tofile="${phptools.phpdox.config}" overwrite="false" filtering="true">
<filterset filtersfile="${phptools.properties.filter}"/>
</copy>
</target>
<target name="phpdox" depends="tools-init, phpdox.exists, phpdox.copy" if="${phptools.phpdox.run}"
description="Generate API documentation using phpDox">
<echo message="Generating phpdox in ${phptools.phpdox.output}" level="${phptools.phpdox.echolevel}"/>
<exec dir="${phptools.builddir}" executable="${phptools.phpdox.phar}" failonerror="${phptools.phpdox.failonerror}">
<arg value="--file"/>
<arg value="${phptools.phpdox.config}"/>
</exec>
<echo message="documentation generation complete" level="${phptools.phpdox.echolevel}" />
</target>
<target name="pdepend.exists" unless="phptools.pdepend.run" depends="tools-init">
<available property="phptools.pdepend.run" file="${phptools.pdepend.phar}" />
</target>
<target name="pdepend" depends="tools-init, pdepend.exists" if="${phptools.pdepend.run}"
description="Calculate software metrics using PHP_Depend">
<echo message="Calculating software metrics using PHP_Depend" level="${phptools.pdepend.echolevel}"/>
<exec dir="${phptools.builddir}" executable="${phptools.pdepend.phar}" failonerror="${phptools.pdepend.failonerror}">
<arg value="--jdepend-xml=${phptools.pdepend.xml}" />
<arg value="--jdepend-chart=${phptools.pdepend.chart}" />
<arg value="--overview-pyramid=${phptools.pdepend.overview-pyramid}" />
<arg path="${phptools.pdepend.srcdir}" />
</exec>
<echo message="PHP_Depend complete" level="${phptools.pdepend.echolevel}"/>
</target>
<!-- PHP Copy paste detector tests -->
<target name="phpcpd.exists" unless="phptools.phpcpd.run" depends="tools-init">
<available property="phptools.phpcpd.run" file="${phptools.phpcpd.phar}" />
</target>
<target name="phpcpd" depends="tools-init, phpcpd.exists" if="${phptools.phpcpd.run}"
description="Find duplicate code using PHPCPD">
<echo message="Find duplicate code using PHPCPD: (${phptools.phpcpd.phar})" level="${phptools.phpcpd.echolevel}" />
<exec dir="${phptools.builddir}" executable="${phptools.phpcpd.phar}" failonerror="${phptools.phpcpd.failonerror}">
<arg value="--log-pmd" />
<arg value="${phptools.phpcpd.log}" />
<arg path="${phptools.phpcpd.srcdir}" />
</exec>
<echo message="PHP Copy-Paste Detection complete" level="${phptools.phpcpd.echolevel}" />
</target>
<!-- Setup PHP_CodeBrowser (https://github.com/Mayflower/PHP_CodeBrowser) -->
<target name="phpcb.exists" depends="tools-init">
<available property="phptools.phpcb.run" file="${phptools.phpcb.phar}" />
</target>
<target name="phpcb" depends="tools-init, phpcb.exists" if="${phptools.phpcb.run}"
description="Aggregate tool output with PHP_CodeBrowser">
<echo message="Beginning PHP_CodeBrowser aggregation" level="${phptools.phpcb.echolevel}" />
<exec dir="${phptools.builddir}" executable="${phptools.phpcb.phar}" failonerror="${phptools.phpcb.failonerror}">
<arg value="--log" />
<arg path="${phptools.phpcb.logdir}" />
<arg value="--output" />
<arg path="${phptools.phpcb.output}" />
<arg value="--source" />
<arg path="${phptools.phpcb.srcdir}" />
</exec>
<echo message="PHP_CodeBrowser aggregation complete, logged to ${phptools.phpcb.logdir}"
level="${phptools.phpcb.echolevel}" />
</target>
<target name="lint" description="Perform static code checking of PHP files" depends="tools-init">
<echo message="Beginning lint tests" level="${phptools.lint.echolevel}"/>
<apply executable="php" failonerror="${phptools.lint.failonerror}">
<arg value="-l" />
<fileset dir="${phptools.lint.srcdir}">
<include name="**/*.php" />
</fileset>
</apply>
<echo message="Lint complete" level="${phptools.lint.echolevel}"/>
</target>
<target name="phploc.exists" unless="phptools.phploc.run" depends="tools-init">
<available property="phptools.phploc.run" file="${phptools.phploc.phar}"/>
</target>
<target name="phploc" depends="tools-init, phploc.exists" if="${phptools.phploc.run}" description="Measure project size using PHPLOC">
<echo message="Running PHPLOC" level="${phptools.phploc.echolevel}"/>
<exec dir="${phptools.builddir}" executable="${phptools.phploc.phar}" failonerror="${phptools.phploc.failonerror}">
<arg value="--log-csv" />
<arg value="${phptools.phploc.csv}" />
<arg path="${phptools.phploc.srcdir}" />
</exec>
<echo message="PHPLOC complete" level="${phptools.phploc.echolevel}"/>
</target>
<!-- PHP CodeSniffer tests -->
<target name="phpcs.exists" unless="phptools.phpcs.run" depends="tools-init">
<available property="phptools.phpcs.run" file="${phptools.phpcs.phar}" />
</target>
<target name="phpcs-ci" depends="tools-init, phpcs.exists" if="${phptools.phpcs.run}" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<echo message="Running PHP CodeSniffer: ${phptools.phpcs.phar}" level="${phptools.phpcs.echolevel}"/>
<exec dir="${phptools.builddir}" executable="${phptools.phpcs.phar}" failonerror="${phptools.phpcs.failonerror}">
<arg value="--standard=${phptools.phpcs.standard}" />
<arg value="--report=${phptools.phpcs.report-format}" />
<arg value="--report-file=${phptools.phpcs.report}" />
<arg value="--report-summary=${phptools.phpcs.report}.summary.log" />
<!-- Quick fix for XML overwritten by summary; FIXME make this properly configurable -->
<arg path="${phptools.phpcs.srcdir}" />
</exec>
<echo message="PHP CodeSniffer complete, logged to ${phptools.phpcs.report}" level="${phptools.phpcs.echolevel}"/>
</target>
<target name="phpcs" depends="tools-init, phpcs.exists" description="Find coding standard violations using PHP_CodeSniffer">
<exec dir="${phptools.builddir}" executable="${phptools.phpcs.phar}">
<arg value="--standard=${phptools.phpcs.standard}" />
<arg path="${phptools.phpcs.srcdir}" />
</exec>
</target>
<!-- PHP Mess Detector -->
<target name="phpmd.exists" unless="phptools.phpmd.run" depends="tools-init">
<available property="phptools.phpmd.run" file="${phptools.phpmd.phar}"/>
<available property="phptools.phpdox.config.nocopy" file="${phptools.phpmd.config}"/>
</target>
<target name="phpmd.copy" if="phptools.phpdox.run" unless="phptools.phpdox.config.nocopy">
<echo message="No existing phpmd config found, copying ${phptools.phpmd.dist} to ${phptools.phpmd.config}" level="verbose" />
<copy file="${phptools.phpmd.dist}" tofile="${phptools.phpmd.config}" overwrite="false" filtering="true">
<filterset filtersfile="${phptools.properties.filter}"/>
</copy>
</target>
<target name="phpmd-ci" depends="tools-init, phpmd.exists, phpmd.copy" if="${phptools.phpmd.run}" description="Perform project mess detection using PHPMD">
<echo message="Running PHP Mess Detector" level="${phptools.phpmd.echolevel}"/>
<copy file="${phptools.phpmd.dist}" tofile="${phptools.phpmd.config}" overwrite="false" filtering="true">
<filterset filtersfile="${phptools.properties.filter}"/>
</copy>
<exec dir="${phptools.builddir}" executable="${phptools.phpmd.phar}" failonerror="${phptools.phpmd.failonerror}">
<arg path="${phptools.phpmd.srcdir}" />
<arg value="${phptools.phpmd.format}" />
<arg value="${phptools.phpmd.config}" />
<arg value="--reportfile" />
<arg value="${phptools.phpmd.reportfile}" />
</exec>
<echo message="Mess Detection complete, logged to ${phptools.phpmd.reportfile}" level="${phptools.phpmd.echolevel}"/>
</target>
<target name="phpmd" depends="tools-init, phpmd.exists, phpmd.copy" if="${phptools.phpmd.run}" description="Perform project mess detection using PHPMD">
<echo message="Running PHP Mess Detector" level="${phptools.phpmd.echolevel}"/>
<copy file="${phptools.phpmd.dist}" tofile="${phptools.phpmd.config}" overwrite="false" filtering="true">
<filterset filtersfile="${phptools.properties.filter}"/>
</copy>
<exec dir="${phptools.builddir}" executable="${phptools.phpmd.phar}" failonerror="${phptools.phpmd.failonerror}">
<arg path="${phptools.phpmd.srcdir}" />
<arg value="text" />
<arg value="${phptools.phpmd.config}" />
</exec>
<echo message="Mess Detection complete, logged to ${phptools.phpmd.reportfile}" level="${phptools.phpmd.echolevel}"/>
</target>
</project>