简体   繁体   English

我如何告诉Phing PHPUnit的安装位置?

[英]How do I tell Phing where PHPUnit is installed?

Both Phing and PHPUnit were installed from pear on ubuntu 12.04. Phing和PHPUnit都是在ubuntu 12.04上从pear安装的。

PHPUnit is located at /usr/bin/phpunit and /usr/bin is on the unix path and also on the include_path in PHP.INI PHPUnit位于/ usr / bin / phpunit,/ usr / bin位于unix路径上,也位于PHP.INI中的include_path上

How do I tell Phing where PHPUnit is installed? 我如何告诉Phing PHPUnit的安装位置?

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

Answering my own question, I think the PHP version on this machine could be too old and not be able to handle PHAR archives. 回答我自己的问题,我认为这台机器上的PHP版本太旧了,无法处理PHAR档案。 Or maybe the PHAR configuration is broken. 或者可能是PHAR配置被破坏了。 PHPUnit is installed as PHAR on this machine via PEAR. PHPUnit通过PEAR在此机器上安装为PHAR。

A workaround for me was to not use <phpunit> but <exec> in the target, which worked: 对我来说一个解决方法是不在目标中使用<phpunit><exec> ,它有效:

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

I am not fixing this for now and I am expecting on newer machines it will work out of the box. 我现在还没有解决这个问题,我期待在更新的机器上它可以开箱即用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM