herroffizier/yiiq

View on GitHub
build.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<project name="yiiq" default="help">
    <property name="paratest.defaultProcesses" value="5"/>

    <target name="help">
        <echo>Available commands:

        * cs        - run phpcs
        * lint      - run php lint
        * phpunit   - run phpunit
        * test      - test extension
        * help      - this message</echo>
    </target>

    <target name="cs">
        <exec 
            command="./vendor/bin/phpcs --ignore=./vendor/,./test/jobs/BadJob2.php --report=full --standard=PSR2 -p ." 
            passthru="true" 
            checkreturn="true"
        />
    </target>

    <target name="lint">
        <phplint 
            haltonfailure="true"
            deprecatedAsError="true"
        >
            <fileset dir=".">
                <include name="**/*.php"/>
                <exclude name="vendor/"/>
                <exclude name="test/jobs/BadJob2.php"/>
            </fileset>
        </phplint>
    </target>

    <target name="clearreport">
        <delete includeemptydirs="true" verbose="true">
            <fileset dir="./test/report">
                <exclude name=".gitkeep"/>
                <include name="*"/>
                <include name="**/*"/>
            </fileset>
        </delete>
    </target>

    <target name="phpunit">
        <if>
            <not><isset property="paratest.processes"/></not>
            <then>
                <property name="paratest.processes" value="${paratest.defaultProcesses}"/>
            </then>
        </if>

        <exec 
            command="./vendor/bin/paratest --functional --processes=${paratest.processes} --bootstrap=./test/bootstrap.php --coverage-clover=./test/report/coverage.clover --coverage-html=./test/report/  ./test/unit/" 
            passthru="true" 
            checkreturn="true"
        />
    </target>

    <target name="test">
        <phingcall target="clearreport"/>
        <phingcall target="lint"/>
        <phingcall target="cs"/>
        <phingcall target="phpunit"/>
    </target>

    <target name="travis-test">
        <property name="paratest.processes" value="20"/>

        <phingcall target="clearreport"/>
        <phingcall target="lint"/>
        <phingcall target="cs"/>
        <phingcall target="phpunit"/>
    </target>
</project>