<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="build example">
    <property name="srcDir"			value="/var/www/htdocs" />
	<property name="unittestFailed" value="true" />

	<echo msg="Unittest failureproperty is initialized through PropertyTask as '${unittestFailed}'" />
	<echo msg="IfTask with arg2=1 on that property will pass regardless of actual success of Unittests, leading to 'failed' message." />

	<target name="test" depends="">
		<phpunit printsummary="true" failureproperty="unittestFailed">
			<batchtest>
				<fileset dir="${srcDir}">
					<include name="**/*.php"/>
				</fileset>
			</batchtest>
		</phpunit>
	</target>

	<target name="build" depends="test">
		<if>
			<equals arg1="${unittestFailed}" arg2="1" />
			<then>
				<echo msg="Unittests have failed." />
			</then>
			<else>
				<echo msg="Unittests passed." />
			</else>
		</if>
	</target>
</project>
