Zend框架2 + +的PHPUnit多个模块+持续集成
先谢谢您的任何意见。我刚开始从Zend框架1至ZF2切换,并通过快速启动和其他几个教程后运行我注意到,有一个短暂的默认的方式来使用PHPUnit的到来。如果不是这样,我只是失落和迷惘。
Thanks in advance for any comments. I have just started to switch from Zend Framework 1 to ZF2 and after running through the quick start and several other tutorials I noticed that there is a short coming with the 'default' way to use phpunit. Either that or I am just lost and confused.
有关缺省项目的文件夹结构
The folder structure for a default project is
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
我的问题是我怎么使用詹金斯与ANT测试所有PHPUnit的测试套件。我理解其背后单独测试每个模块的原因,但我怎么能正确地自动执行得到一个report.xml将回来。如果我没有需要在PHPUnit的配置指定每个模块它甚至会更好。或者build.xml文件。
My question is this how do I use Jenkins with ANT to test all of the phpunit test suites. I understand the reason behind testing each module individually but how can I properly automate that to get one report.xml back. And it would be even better if I didn't need to specify each module in a phpunit config. or the build.xml.
再次感谢您的任何意见。
Again thank you for any comments.
我忘了回答我的问题时,我想通了我道歉,我忘了......社会各界但每个人受益这里是我得到了它工作。
I forgot to answer my own question when I figured it out I apologize to the community that I forgot... but for everyones benefit here is how I got it to work.
的build.xml
build.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>
和每个模块的phpunit.xml
And the phpunit.xml for each module
<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>