一尘不染

Phing看不到PHPUnit

jenkins

我正在尝试设置一个新的Continuous Integration服务器,该服务器利用Phing和PHPUnit自动运行测试用例。

我已经在Pear中安装了Phing:

pear channel-discover pear.phing.info
pear install phing/phing

我已经使用新的PHAR方法安装了PHPUnit:

wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit

然后,我进入build.xml文件所在的目录,梯级phing,看来Phing不知道PHPUnit在哪里。

[jenkins@leroy workspace]$ phing
Buildfile: /home/jenkins/.jenkins/jobs/Framework/workspace/build.xml

Framework > test:

 [echo] Running Tests
Execution of target "test" failed for the following reason: /home/jenkins/.jenkins/jobs/Framework/workspace/build.xml:9:37: /home/jenkins/.jenkins/jobs/Framework/workspace/build.xml:9:37: PHPUnitTask requires PHPUnit to be installed

BUILD FAILED
/home/jenkins/.jenkins/jobs/Framework/workspace/build.xml:9:37:
/home/jenkins/.jenkins/jobs/Framework/workspace/build.xml:9:37: PHPUnitTask requires PHPUnit to be installed
Total time: 0.0764 seconds

[jenkins@leroy workspace]$

检查了Phing和PHPUnit的位置:

[jenkins@leroy workspace]$ which phing
/usr/bin/phing
[jenkins@leroy workspace]$ which phpunit
/usr/local/bin/phpunit

并且,确保PHP是足够新的:

[jenkins@leroy workspace]$ php -v
PHP 5.3.3 (cli) (built: Dec 11 2013 03:29:57)

我之所以这样做,是因为我们要用新服务器替换旧的Jenkins服务器。尝试使用最新的软件,但我不知道如何告诉Phing在哪里可以找到PHPUnit。

在此先感谢您的帮助!

大卫


阅读 226

收藏
2020-07-25

共1个答案

一尘不染

似乎phing和PHPUnit的最新4.x版本存在一些实际问题:http
://www.phing.info/trac/ticket/1091

因此,为解决此问题,我删除了PHPUnit 4并指定了较旧的版本:

pear install phpunit/PHPUnit-3.7.35

Phing和PHPUnit在这一点上立即起作用。

2020-07-25