| 1 | <?xml version="1.0" encoding="UTF-8"?>
|
|---|
| 2 | <project basedir="." default="build" name="build example">
|
|---|
| 3 | <property name="srcDir" value="/var/www/htdocs" />
|
|---|
| 4 |
|
|---|
| 5 | <echo msg="Unittest failureproperty is not initialized" />
|
|---|
| 6 | <echo msg="IfTask with arg2=1 on that property will work correctly, displaying the success of the Unittests." />
|
|---|
| 7 |
|
|---|
| 8 | <target name="test" depends="">
|
|---|
| 9 | <phpunit printsummary="true" failureproperty="unittestFailed">
|
|---|
| 10 | <batchtest>
|
|---|
| 11 | <fileset dir="${srcDir}">
|
|---|
| 12 | <include name="**/*.php"/>
|
|---|
| 13 | </fileset>
|
|---|
| 14 | </batchtest>
|
|---|
| 15 | </phpunit>
|
|---|
| 16 | </target>
|
|---|
| 17 |
|
|---|
| 18 | <target name="build" depends="test">
|
|---|
| 19 | <if>
|
|---|
| 20 | <equals arg1="${unittestFailed}" arg2="1" />
|
|---|
| 21 | <then>
|
|---|
| 22 | <echo msg="Unittests have failed." />
|
|---|
| 23 | </then>
|
|---|
| 24 | <else>
|
|---|
| 25 | <echo msg="Unittests passed." />
|
|---|
| 26 | </else>
|
|---|
| 27 | </if>
|
|---|
| 28 | </target>
|
|---|
| 29 | </project> |
|---|