-
Notifications
You must be signed in to change notification settings - Fork 0
/
PHP_Unit.xml
99 lines (87 loc) · 4.98 KB
/
PHP_Unit.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
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="PHP - PHPUnit">
<description>PHPUnit</description>
<settings>
<parameters>
<param name="system.phpunit.runtime" value="" spec="text description='PHPUnit runtime (if empty - latest PHPUnit.phar will be downloaded)' display='normal' label='PHPUnit runtime:' validationMode='any'" />
<param name="system.phpunit.configuration" value="" spec="text description='PHPUnit configuration file' display='normal' label='PHPUnit configuration file:' validationMode='not_empty'" />
<param name="system.php.workingDir.dir" value="" spec="text description='Working directory (if empty - current working directory will be used)' display='normal' label='Working directory:' validationMode='any'" />
<param name="system.phpunit.params" value="" spec="text description='Optional PHPUnit parameters' display='normal' label='PHPUnit parameters:' validationMode='any'" />
<param name="system.phpunit.coverage.set" value="" spec="checkbox checkedValue='true' description='Enable if you want to enable PHPUnit code coverage reports' display='normal' label='Collect code coverage:' uncheckedValue='false'" />
</parameters>
<build-runners>
<runner id="RUNNER_14" name="" type="Ant">
<parameters>
<param name="build-file"><![CDATA[<project name="PHPUnit">
<condition property="php.workingDir" value="${teamcity.build.workingDir}">
<not>
<matches pattern=".+" string="${php.workingDir.dir}"/>
</not>
</condition>
<property name="php.workingDir" value="${php.workingDir.dir}" />
<condition property="phpunit.runtime.set">
<matches pattern=".+" string="${phpunit.runtime}"/>
</condition>
<condition property="phpunit.runtime.exec" value="${teamcity.build.tempDir}/phpunit.phar">
<not>
<matches pattern=".+" string="${phpunit.runtime}"/>
</not>
</condition>
<property name="phpunit.runtime.exec" value="${phpunit.runtime}"/>
<property name="phpunit.junit.log" value="${teamcity.build.tempDir}/phpunit-log.xml"/>
<property name="phpunit.coverage.clover" value="${teamcity.build.tempDir}/clover.xml"/>
<property name="phpunit.coverage.dir" value="${teamcity.build.workingDir}/tccoverage"/>
<property name="phpunit.coverage.zip" value="${teamcity.build.workingDir}/coverage.zip"/>
<condition property="phpunit.coverage.param" value="--coverage-clover ${phpunit.coverage.clover} --coverage-html ${phpunit.coverage.dir}">
<istrue value="${phpunit.coverage.set}"/>
</condition>
<condition property="phpunit.coverage.param" value="">
<isfalse value="${phpunit.coverage.set}"/>
</condition>
<property name="phpunit.result.error" value="false" />
<target name="runTests" depends="getPhpUnit,runPhpUnitPhar,runPhpUnitRuntime,collectCoverage">
<fail message="Unit test error." if="${phpunit.result.error}" />
</target>
<target name="collectCoverage" depends="runPhpUnitPhar,runPhpUnitRuntime" if="${phpunit.coverage.set}">
<zip destfile="${phpunit.coverage.zip}" basedir="${phpunit.coverage.dir}" />
<echo>##teamcity[publishArtifacts '${phpunit.coverage.zip}']</echo>
</target>
<target name="runPhpUnitPhar" depends="getPhpUnit" unless="phpunit.runtime.set">
<exec executable="%system.php.binDir%/php" dir="${php.workingDir}" failonerror="false" resultproperty="phpunit.result">
<arg line="-f "${phpunit.runtime.exec}" -d display_errors=On -- -c "${phpunit.configuration}" --log-junit ${phpunit.junit.log} ${phpunit.coverage.param} ${phpunit.params}"/>
</exec>
<echo>##teamcity[importData type='junit' path='${phpunit.junit.log}']</echo>
<condition property="phpunit.result.error">
<not>
<equals arg1="0" arg2="${phpunit.result}"/>
</not>
</condition>
</target>
<target name="runPhpUnitRuntime" depends="getPhpUnit" if="phpunit.runtime.set">
<exec executable="${phpunit.runtime}" dir="${php.workingDir}" failonerror="false" resultproperty="phpunit.result">
<arg line="-c "${phpunit.configuration}" --log-junit ${phpunit.junit.log} ${phpunit.coverage.param} ${phpunit.params}"/>
</exec>
<echo>##teamcity[importData type='junit' path='${phpunit.junit.log}']</echo>
<condition property="phpunit.result.error">
<not>
<equals arg1="0" arg2="${phpunit.result}"/>
</not>
</condition>
</target>
<target name="getPhpUnit" unless="phpunit.runtime.set">
<get src="http://phar.phpunit.de/phpunit.phar" dest="${teamcity.build.tempDir}" verbose="on" skipexisting="false"/>
</target>
</project>]]></param>
<param name="build-file-path" value="build.xml" />
<param name="target" value="runTests" />
<param name="teamcity.coverage.emma.include.source" value="true" />
<param name="teamcity.coverage.emma.instr.parameters" value="-ix -*Test*" />
<param name="teamcity.coverage.idea.includePatterns" value="*" />
<param name="teamcity.step.mode" value="default" />
<param name="use-custom-build-file" value="true" />
</parameters>
</runner>
</build-runners>
<requirements />
</settings>
</meta-runner>