zend框架2 + phpunit +多个模块+持续集成

Jos*_*ota 12 ant phpunit jenkins zend-framework2

提前感谢您的任何意见.我刚刚开始从Zend Framework 1切换到ZF2,在完成快速启动和其他几个教程后,我注意到使用phpunit的'默认'方式有一个短暂的结果.无论是那个还是我只是迷茫而迷茫.

默认项目的文件夹结构是

Project
| - config
| | - autoload
| | | - global.php
| | | - local.php.dist
| | - application.config.php
| - data
| - module
| | - Application
| | | - config
| | | - src
| | | - test
| | | | - ApplicationTest
| | | | - Bootstrap.php
| | | | - phpunit.xml
| | | | - TestConfig.php.dist 
| | | - view
| | | - Module.php
| | - Album
| | | - config
| | | - src
| | | - test
| | | | - AlbumTest
| | | | - Bootstrap.php
| | | | - phpunit.xml
| | | | - TestConfig.php.dist 
| | | - view
| | | - Module.php
| - public
| - vendor
Run Code Online (Sandbox Code Playgroud)

我的问题是如何使用Jenkins和ANT来测试所有的phpunit测试套件.我理解单独测试每个模块背后的原因,但是如何正确地自动化它以获得一个report.xml.如果我不需要在phpunit配置中指定每个模块,那就更好了.或build.xml.

再次感谢您的任何评论.

Jos*_*ota 4

当我弄清楚时,我忘了回答我自己的问题,我向社区道歉,我忘记了……但为了每个人的利益,我是如何让它发挥作用的。

构建.xml

<target name="phpunit" description="Run unit tests with PHPUnit">
    <apply executable="../vendor/bin/phpunit" parallel="false">
        <fileset dir="${env.WORKSPACE}/module" >
            <include name="**/test/phpunit.xml"/>
        </fileset>
        <arg value="--configuration" />
        <srcfile/>
    </apply>
</target>
Run Code Online (Sandbox Code Playgroud)

以及每个模块的 phpunit.xml

<phpunit bootstrap="Bootstrap.php">
    <testsuites>
        <testsuite name="Application">
            <directory>./</directory>
        </testsuite>
    </testsuites>

<!-- Filters only matter for code coverage reporting -->
    <filter>
        <blacklist>
            <directory>../../../vendor/</directory>
            <directory>./</directory>
            <file>../Module.php</file>
        </blacklist>
    </filter>
    <logging>
        <log type="coverage-html" target="../../../build/coverage" title="Application Module" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
        <log type="coverage-clover" target="../../../build/logs/clover-Application.xml"/>
        <log type="junit" target="../../../build/logs/junit-Application.xml" logIncompleteSkipped="false"/>
    </logging>
</phpunit>
Run Code Online (Sandbox Code Playgroud)