ludofleury
4/10/2012 - 12:01 AM

.atoum.ci.php

{
    "suggest": {
        "mageekguy/atoum": "dev-master"
     }
}
<?xml version="1.0" encoding="UTF-8"?>

<project name="PlemiSymfonyTemplate" default="build">
  <target name="build" depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpDocumentor,atoum"/>
  <target name="build-parallel" depends="prepare,lint,tools-parallel,atoum"/>
  <target name="tools-parallel" description="Run tools in parallel">
    <parallel threadCount="2">
      <sequential>
        <antcall target="pdepend"/>
        <antcall target="phpmd-ci"/>
      </sequential>
        <antcall target="phpcpd"/>
        <antcall target="phpcs-ci"/>
        <antcall target="phploc"/>
        <antcall target="phpDocumentor"/>
    </parallel>
  </target>
  <target name="clean" description="Cleanup build artifacts">
    <delete dir="${basedir}/build/api"/>
    <delete dir="${basedir}/build/code-browser"/>
    <delete dir="${basedir}/build/coverage"/>
    <delete dir="${basedir}/build/doc"/>
    <delete dir="${basedir}/build/logs"/>
    <delete dir="${basedir}/build/pdepend"/>
    <delete dir="${basedir}/vendor"/>
    <delete file="${basedir}/composer.phar"/>
    <delete file="${basedir}/composer.lock"/>
  </target>
  <target name="prepare" depends="clean,composer" description="Prepare for build">
    <mkdir dir="${basedir}/build/api"/>
    <mkdir dir="${basedir}/build/code-browser"/>
    <mkdir dir="${basedir}/build/coverage"/>
    <mkdir dir="${basedir}/build/doc"/>
    <mkdir dir="${basedir}/build/logs"/>
    <mkdir dir="${basedir}/build/pdepend"/>
  </target>
  <target name="composer" description="Installing dependencies">
    <exec executable="wget" failonerror="true">
      <arg value="-nc" />
      <arg value="http://getcomposer.org/composer.phar" />
    </exec>
    <exec executable="php" failonerror="true">
      <arg value="composer.phar" />
      <arg value="install" />
      <arg value="--install-suggests" />
    </exec>
  </target>
  <target name="lint">
    <apply executable="php" failonerror="true">
      <arg value="-l" />
      <fileset dir="${basedir}">
        <exclude name="**/vendor/**" />
        <include name="**/*.php" />
      </fileset>
      <fileset dir="${basedir}/web">
        <exclude name="**/bundles/**" />
        <include name="**/*.php" />
        <modified />
      </fileset>
    </apply>
  </target>
  <target name="phploc" description="Measure project size using PHPLOC">
    <exec executable="phploc">
      <arg value="--exclude" />
      <arg value="vendor" />
      <arg value="--log-csv" />
      <arg value="${basedir}/build/logs/phploc.csv" />
      <arg path="${basedir}" />
    </exec>
  </target>
  <target name="pdepend" description="Calculate software metrics using PHP_Depend">
    <exec executable="pdepend">
      <arg value="--phpunit-xml=${basedir}/build/logs/pdepend.xml" />
      <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
      <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
      <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
      <arg value="--ignore=vendor" />
      <arg path="${basedir}" />
    </exec>
  </target>
  <target name="phpmd" description="Perform project mess detection using PHPMD">
    <exec executable="phpmd">
      <arg path="${basedir}" />
      <arg value="text" />
      <arg value="${basedir}/build/phpmd.xml" />
      <arg value="--exclude" />
      <arg value="vendor" />
    </exec>
  </target>
  <target name="phpmd-ci" description="Perform project mess detection using PHPMD">
    <exec executable="phpmd">
      <arg path="${basedir}" />
      <arg value="xml" />
      <arg value="codesize,unusedcode,design" />
      <arg value="--reportfile" />
      <arg value="${basedir}/build/logs/pmd.xml" />
      <arg value="--exclude" />
      <arg value="app,vendor,web" />
    </exec>
  </target>
  <target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer">
    <exec executable="phpcs">
      <arg value="--ignore=vendor/**" />
      <arg path="${basedir}" />
    </exec>
  </target>
  <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer">
    <exec executable="phpcs" output="/dev/null">
      <arg value="--ignore=vendor/**,Tests/**,app/**,web/**" />
      <arg value="--report=checkstyle" />
      <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
      <arg path="${basedir}" />
    </exec>
  </target>
  <target name="phpcpd" description="Find duplicate code using PHPCPD">
    <exec executable="phpcpd">
      <arg value="--exclude" />
      <arg value="vendor" />
      <arg value="--log-pmd" />
      <arg value="${basedir}/build/logs/pmd-cpd.xml" />
      <arg path="${basedir}" />
    </exec>
  </target>
  <target name="atoum" description="Run unit tests with Atoum">
    <exec executable="bin/atoum" failonerror="false">
      <arg line="--configuration-files .atoum.php.ci" />
      <arg line="--bootstrap-file app/bootstrap.php.cache" />
      <arg line="--glob ${basedir}/src/Plemi/*Bundle/Tests/Units" />
    </exec>
  </target>
  <target name="phpDocumentor" description="Generate code documentation with phpDocumentor">
    <exec executable="phpdoc">
      <arg value="--directory" />
      <arg value="${basedir}/src" />
      <arg value="--target" />
      <arg value="${basedir}/build/doc" />
      <arg value="--title" />
      <arg value="Plemi Documentation" />
      <arg value="--ignore" />
      <arg value="app/*,build/*,vendor/*,Tests/*,web/*" />
      <arg value="--extensions" />
      <arg value="php" />
    </exec>
  </target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="YourProject" default="build">  
  <target name="phpDocumentor" description="Generate code documentation with phpDocumentor">
    <exec executable="phpdoc">
      <arg value="--directory" />
      <arg value="${basedir}/src" />
      <arg value="--target" />
      <arg value="${basedir}/build/doc" />
      <arg value="--title" />
      <arg value="Your title" />
      <arg value="--ignore" />
      <arg value="vendor/*,Tests/*,web/*" />
      <arg value="--extensions" />
      <arg value="php" />
    </exec>
  </target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="YourProject" default="build"> 
  <target name="composer" description="Installing dependencies">
    <exec executable="wget" failonerror="true">
      <arg value="-nc" />
      <arg value="http://getcomposer.org/composer.phar" />
    </exec>
    <exec executable="php" failonerror="true">
      <arg value="composer.phar" />
      <arg value="install" />
      <arg value="--install-suggests" />
    </exec>
  </target>

  <target name="clean" description="Cleanup build artifacts">
    <delete dir="${basedir}/build/api"/>
    <delete dir="${basedir}/build/code-browser"/>
    <delete dir="${basedir}/build/coverage"/>
    <delete dir="${basedir}/build/doc"/>
    <delete dir="${basedir}/build/logs"/>
    <delete dir="${basedir}/build/pdepend"/>
    <delete dir="${basedir}/vendor"/>
    <delete file="${basedir}/composer.phar"/>
    <delete file="${basedir}/composer.lock"/>
  </target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="YourProject" default="build">
  <target name="atoum" description="Run unit tests with atoum">
    <exec executable="bin/atoum" failonerror="false">
      <arg line="--configuration-files .atoum.php.ci" />
      <arg line="--bootstrap-file app/bootstrap.php.cache" />
      <arg line="--glob ${basedir}/src/Vendor/*Bundle/Tests/Units" />
    </exec>
  </target>
</project>
$ bin/atoum -bf app/bootstrap.php.cache -g src/*Bundle/Tests/Units
<?php

namespace Vendor\YourBundle\Tests\Units;

use mageekguy\atoum\test as AtoumTest;

abstract class Test extends AtoumTest
{
    public function construct(score $score = null, locale $locale = null, adapter $adapter = null)
    {
        $this->setTestNamespace('\Tests\Units\');
        parent::construct($score, $locale, $adapter);
    }
}
<?php

/*
 * CLI report.
 */
$stdOutWriter = new \mageekguy\atoum\writers\std\out();
$cli = new \mageekguy\atoum\reports\realtime\cli();
$cli->addWriter($stdOutWriter);

/*
 * Xunit report
 */
$xunitWriter = new \mageekguy\atoum\writers\file(__DIR__.'/build/logs/junit.xml');
$xunit = new \mageekguy\atoum\reports\asynchronous\xunit();
$xunit->addWriter($xunitWriter);

/*
 * Clover xml coverage
 */
$cloverWriter = new \mageekguy\atoum\writers\file(__DIR__.'/build/logs/clover.xml');
$clover = new \mageekguy\atoum\reports\asynchronous\clover();
$clover->addWriter($cloverWriter);

/*
 * Html coverage
 */
$html = new \mageekguy\atoum\report\fields\runner\coverage\html('Plemi API',  __DIR__.'/build/coverage');
$cli->addField($html, array(\mageekguy\atoum\runner::runStop));

$runner->addReport($clover);
$runner->addReport($xunit);
$runner->addReport($cli);