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

标签 php phpunit phing

我有一个现有的 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。

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

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

甚至那个 phpunit 应该会自动找到 phpunit.xml(当我手动启动它就像在我的终端输入“phpunit”并按下 enter,它工作)并使用它,在 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"/>

关于php - 如何在 phing build.xml 中使用现有的 phpunit.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11824932/

相关文章:

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP

javascript - 如何在 Angular js中获取 Controller 的路由值

php - 好的 Phing 工作流程是什么样的?

php - Symfony2 - 如何将复选框/ radio 的标签和输入放在同一行?

php - symfony的测试和浏览器有什么区别

php - 如何为fopen()中的错误文件路径在PHPUnit中设置预期的异常?

php - 如何在 testdox 名称中使用大写首字母?

linux - Linux Mint 中 Selenium PHPUnit 测试中的空白 Firefox 窗口问题

build - Phing和 Composer

php - 根本无法运行 phing