我如何告诉PhingPHPUnit的安装位置


How do I tell Phing where PHPUnit is installed?

Phing 和 PHPUnit 都是从 ubuntu 12.04 上的 pear 安装的。

PHPUnit 位于/usr/bin/phpunit 上,/usr/bin 位于 unix 路径上,也位于 PHP 中的include_path上。.INI

我如何告诉PhingPHPUnit安装在哪里?

webroot@gm3:~/med1/pub$ phing utest
Buildfile: /home/webroot/med1/pub/build.xml
myproject > utest:
     [echo] Unittests PHPUnit...
Execution of target "utest" failed for the following reason: /home/webroot/med1/pub/build.xml:8:40: /home/webroot/med1/pub/build.xml:8:40: PHPUnitTask requires PHPUnit to be installed
BUILD FAILED
/home/webroot/med1/pub/build.xml:8:40: /home/webroot/med1/pub/build.xml:8:40: PHPUnitTask requires PHPUnit to be installed
Total time: 0.1148 seconds

回答我自己的问题,我认为这台机器上的PHP版本可能太旧了,无法处理PHAR档案。或者 PHAR 配置可能已损坏。PHPUnit 通过 PEAR 作为 PHAR 安装在这台机器上。

对我来说,解决方法是不在目标中使用<phpunit>而是<exec>,这有效:

<target name="test">
  <exec command="phpunit --bootstrap tests/bootstrap.php --configuration tests/phpunit.xml">
    ...  

我现在没有解决这个问题,我期望在较新的机器上开箱即用。