简体   繁体   English

Zend的PHPunit兼容性问题

[英]PHPunit Comaptiablity issue with Zend

I have configured PHPUnit with Zend Framework. 我已经用Zend Framework配置了PHPUnit。 When I run the command 当我运行命令

phpunit --configuration phpunit.xml

I receive the failure message like 我收到类似的失败消息

Declaration of Zend_Test_PHPUnit_Constraint_ResponseHeader::evaluate() should be compatible with that of PHPUnit_Framework_Constraint::evaluate()

I have following assert functions 我有以下assert功能

$this->assertModule($urlParams['module']);
$this->assertController($urlParams['controller']);
$this->assertAction($urlParams['action']);
$this->assertResponseCode(200);

I searched out the problem and found many related solutions like stated here . 我搜索了这个问题,发现类似规定很多相关的解决方案在这里 I checked my PHPUnit version it is 3.7.9 and Zend Framework 1 only properly function with PHPUnit 3.5.x . 我检查了我的PHPUnit版本是否为3.7.9并且Zend Framework 1仅可与PHPUnit 3.5.x一起正常使用。

Then I tried to downgrade the PHPUnit as stated here . 然后,我尝试按照此处所述降级PHPUnit The un-installation process runs successfully. un-installation过程成功运行。 But when I go to install the downgraded version and run the command 但是当我去安装降级版本并运行命令时

pear install phpunit/PHP_CodeCoverage-1.0.2

It generates an error 它产生一个错误

phing/phing requires package "phpunit/PHP_CodeCoverage" (version >= 1.1.0). phpunit/PHP_CodeCoverage cannot be installed, Conflicts with installed packages. 

Some body tell me how to handle this situation? 有人告诉我该如何处理? How to make installed PHPUnit version compatible with Zend Framework 1.X or how to properly downgrade my PHPUnit?? 如何使已安装的PHPUnit版本与Zend Framework 1.X兼容,或者如何正确降级我的PHPUnit?

Best Regards. 最好的祝福。

You can always install 2 different instances of PHPUnit. 您始终可以安装2个不同的PHPUnit实例。 Install with pear the latest version of PHPUnit to get Phing to work, and install the PHPunit version 3.5.x with Composer - as instructed here . 使用pear安装最新版本的PHPUnit以使Phing正常工作,并按照Composer的说明安装PHPunit版本3.5.x- 此处指示。

If everything is done correctly, you will have a system-wide PHPUnit at the latest version, and in your project folder in vendors/bin you will have PHPunit 3.5.x . 如果一切都正确完成,则您将拥有最新版本的系统范围的PHPUnit,并且在vendor vendors/bin中的项目文件夹中,您将拥有PHPunit3.5.x。 Use the second one to build tests in ZF1. 使用第二个在ZF1中构建测试。

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

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