<?xml version="1.0" encoding="UTF-8"?>
<project name="WebToPay" default="build" basedir="..">
    <target name="test">
        <exec command="composer -d /var/www run phpunit" passthru="true" returnProperty="phpunitResult" />
        <if>
            <equals arg1="${phpunitResult}" arg2="0" />
            <then>
                <echo message="Tests passed successfully" />
            </then>
            <else>
                <fail message="Stopping build, tests do not pass" />
            </else>
        </if>
    </target>
    <target name="build" depends="test">
        <echo msg="Combining all php files into one" />
        <echo file="/var/www/WebToPay.php" append="false">&lt;?php
/*
 * This file is autogenerated, DO NOT EDIT
 */

declare(strict_types=1);
        </echo>
        <append destFile="/var/www/WebToPay.php">
            <filterchain>
                <replaceregexp>
                    <regexp pattern="^\&lt;\?php" replace="" />
                </replaceregexp>
                <replaceregexp>
                    <regexp pattern=".*declare\(strict_types=1\);\s*" replace="" />
                </replaceregexp>
            </filterchain>
            <filelist dir="/var/www/src" files="WebToPay.php,WebToPayException.php" />
        </append>
        <append destFile="/var/www/WebToPay.php">
            <filterchain>
                <replaceregexp>
                    <regexp pattern="^\&lt;\?php" replace="" />
                </replaceregexp>
                <replaceregexp>
                    <regexp pattern=".*declare\(strict_types=1\);\s*" replace="" />
                </replaceregexp>
            </filterchain>
            <fileset dir="/var/www/src/WebToPay">
                <include name="**/*.php"/>
            </fileset>
        </append>
    </target>
</project>