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

Rad*_*mko 4 php phing phpunit

我有一个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>
Run Code Online (Sandbox Code Playgroud)

正如DRY所说,我不想简单地将phpunit.xml的内容复制并粘贴到我的build.xml中以运行具有相同配置的phpunit.

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

<target name="unit-test">
    <phpunit printsummary="true" />
</target>
Run Code Online (Sandbox Code Playgroud)

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

[phpunit] Total tests run: 0, Failures: 0, Errors: 0, Incomplete: 0, Skipped: 0, Time elapsed: 0.00122 s
Run Code Online (Sandbox Code Playgroud)

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

cwe*_*ske 9

这是可能的,因为与phing 2.4.13 配置属性:

<phpunit configuration="path/to/phpunit.xml"/>
Run Code Online (Sandbox Code Playgroud)