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
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
<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>
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With