微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在phing build.xml中使用现有的phpunit.xml?

我有一个PHPunit.xml(PHPunit的配置文件),如下所示:

<PHPunit backupGlobals="false"
    backupStaticAttributes="false"
    bootstrap="./tests/bootstrap.PHP"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    strict="true" 
    verbose="true"
    colors="true">

    <testsuites>
        <testsuite name="My Tests">
            <directory>./tests</directory>
        </testsuite>
</testsuites>
</PHPunit>

正如DRY所说,我不想简单地复制&将PHPunit.xml的内容粘贴到我的build.xml,以便使用相同的配置运行PHPunit.

我在Phing的build.xml中的目标如下所示:

<target name="unit-test">
    <PHPunit printsummary="true" />
</target>

即使那个PHPunit应该自动找到PHPunit.xml(当我手动启动它就像输入“PHPunit”到我的终端并按下回车,它可以工作)并使用它,在phing的情况下,输出看起来像这样:

[PHPunit] Total tests run: 0,Failures: 0,Errors: 0,Incomplete: 0,Skipped: 0,Time elapsed: 0.00122 s

那么有什么方法,如何达到描述的行为?

解决方法

这可能是 since phing 2.4.13与 configuration属性

<PHPunit configuration="path/to/PHPunit.xml"/>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。