<?xml version="1.0"?>
<project default="default">

	<target name="default" depends="phpcs, test"/>

	<fileset dir="." id="php">
		<include name="**/*.php"/>
		<exclude name="vendor/**" />
		<exclude name="cache/**" />
	</fileset>

	<target name="phpcs">
		<phpcodesniffer standard="PSR2" haltonerror="true">
			<fileset refid="php"/>
			<formatter type="full" usefile="false"/>
		</phpcodesniffer>
	</target>

	<target name="test">
		<exec executable="phpunit" passthru="true" checkreturn="true">
			<arg value="--bootstrap"/>
			<arg value="vendor/autoload.php"/>
		</exec>
	</target>

	<target name="fix">
		<phpcodesniffer standard="PSR2">
			<fileset refid="php"/>
			<formatter type="diff" outfile="changes.diff"/>
		</phpcodesniffer>
		<exec command="patch -p0 &lt; changes.diff" passthru="true"/>
		<exec command="rm changes.diff" passthru="true"/>
	</target>
</project>

<?xml version="1.0"?>
<project default="default">
	<target name="default" depends="phpcs, test"/>

	<target name="phpcs">
		<phpcodesniffer standard="PSR2" haltonerror="true">
			<fileset refid="php"/>
			<formatter type="full" usefile="false"/>
		</phpcodesniffer>
	</target>

	<target name="test">
		<phpunit haltonerror="true" haltonfailure="true" bootstrap="vendor/autoload.php">
			<batchtest>
				<fileset refid="tests"/>
			</batchtest>
		</phpunit>
	</target>

	<target name="fix">
		<phpcodesniffer standard="PSR2">
			<fileset refid="php"/>
			<formatter type="diff" outfile="changes.diff"/>
		</phpcodesniffer>
		<exec command="patch -p0 &lt; changes.diff" passthru="true"/>
		<exec command="rm changes.diff" passthru="true"/>
	</target>

	<fileset dir="." id="php">
		<include name="**/*.php"/>
		<exclude name="vendor/**" />
		<exclude name="cache/**" />
	</fileset>

	<fileset dir="." id="tests">
		<include name="tests/**/*.php"/>
	</fileset>

</project>

Use built-in PHPUnit for Phing
Use built-in PHPUnit for Phing
