程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了zend framework 2 + phpunit +多个模块+持续集成大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决zend framework 2 + phpunit +多个模块+持续集成?

开发过程中遇到zend framework 2 + phpunit +多个模块+持续集成的问题如何解决?下面主要结合日常开发的经验,给出你关于zend framework 2 + phpunit +多个模块+持续集成的解决方法建议,希望对你解决zend framework 2 + phpunit +多个模块+持续集成有所启发或帮助;

当我发现这个问题时,我忘了回答自己的问题,我向忘了的社区表示歉意……但是,对于每个人来说,这是如何使它起作用的。

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>
@H_944_8@

以及每个模块的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>
@H_944_8@

解决方法

预先感谢您的任何评论。我刚刚开始从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
@H_944_8@

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

再次感谢您的任何评论。

大佬总结

以上是大佬教程为你收集整理的zend framework 2 + phpunit +多个模块+持续集成全部内容,希望文章能够帮你解决zend framework 2 + phpunit +多个模块+持续集成所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。