travi/php-framework

View on GitHub
build.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>

<project default="gates" name="travi-framework">
    <property name="basedir" value="${project.basedir}"/>
    <property name="shared.dir" value="${basedir}"/>
    <property file="build/shared.properties"/>
    <property file="build/build.properties"/>

    <target name="gates">
        <phingcall target="checkstyle"/>
        <phingcall target="messDetect"/>
        <phingcall target="test"/>
    </target>

    <target name="test">
        <phingcall target="unit"/>
        <phingcall target="acceptance"/>
    </target>

    <fileset dir="${src.dir}" id="all-src-files">
        <include name="**/*.php"/>
    </fileset>

    <fileset dir="test/php/unit" id="all-unit-tests">
        <include name="**/*Test.php"/>
    </fileset>

    <target name="checkstyle">
        <mkdir dir="${build.logs}"/>
        <phpcodesniffer standard="build/codingStandard.xml"
                        haltonwarning="false"
                        haltonerror="true">
            <fileset refid="all-src-files" />
            <formatter type="full" usefile="false"/>
            <formatter type="checkstyle" outfile="${build.logs}/checkstyle.xml"/>
        </phpcodesniffer>
    </target>

    <target name="messDetect">
        <mkdir dir="${build.logs}"/>
        <phpcpd>
            <fileset refid="all-src-files" />
            <formatter type="pmd" outfile="${build.logs}/pmd-cpd.xml"/>
        </phpcpd>
        <phpmd rulesets="codesize,design">
            <fileset refid="all-src-files" />
            <formatter type="text" useFile="false" outfile="${build.logs}/pmd.txt"/>
            <formatter type="xml" useFile="true" outfile="${build.logs}/pmd.xml"/>
        </phpmd>
    </target>

    <target name="unit">
        <mkdir dir="${build.logs}"/>
        <coverage-setup database="logs/coverage-database">
            <fileset dir="php/framework">
                <patternset>
                    <include name="src/**/*.php"/>
                    <include name="objects/**/*.php"/>
                    <exclude name="src/travi/framework/exception/*.php"/>
                    <exclude name="src/travi/framework/http/RestClient.php"/>
                    <exclude name="objects/utility/upload.class.php"/>
                    <exclude name="src/core/init.php"/>
                </patternset>
            </fileset>
        </coverage-setup>
        <phpunit configuration="config/phpunit.xml"
                 haltonerror="true"
                 printsummary="true"
                 haltonfailure="true"
                 codecoverage="true">
            <batchtest> <fileset refid="all-unit-tests" /> </batchtest>
            <formatter type="plain" usefile="false"/>
            <formatter type="xml" todir="${build.logs}" outfile="phpunit.xml"/>
            <formatter type="clover" todir="${build.logs}" outfile="clover.xml"/>
        </phpunit>
    </target>

    <target name="acceptance">
        <mkdir dir="${build.logs}/behat"/>
        <exec checkreturn="true"
              passthru="true"
              command="vendor/bin/behat --strict --profile ci"/>
    </target>
</project>