【发布时间】:2015-04-06 00:39:12
【问题描述】:
我在尝试运行测试时遇到的错误:
Fatal error: Class 'PHPUnit_Util_Diff' not found in Cake/TestSuite/Reporter/CakeHtmlReporter.php on line 267
根据this question 和那里的答案,我需要安装 PHPUnit 3.6.x 以避免缺少 Class 错误。如何安装这个现已弃用的版本?
我试过像这样使用作曲家:
composer global require "phpunit/phpunit=3.6.*"
但我收到以下错误
Problem 1
- The requested package phpunit/phpunit could not be found in any version, there may be a typo in the package name.
我用这个命令试过 PEAR:
sudo pear install phpunit/PHPUnit-3.6.12
但我收到此错误:
Attempting to discover channel "phpunit"...
Attempting fallback to https instead of http on channel "phpunit"...
unknown channel "phpunit" in "phpunit/phpunit-3.6.12"
invalid package name/package file "phpunit/phpunit-3.6.12"
install failed
我找到了一个答案here,它将我指向dereuromark's plugin,该答案已被弃用,并建议我使用composer,因为PHPUnit 的梨形通道已关闭。更不用说它是 3.7.x 版本,它缺少我需要的类。所以,我绕了一圈。
tl;dr 如何为 CakePHP 2.4.x 安装 PHPUnit 3.6.x?
更新:我检查了在最新的 CakePHP 2.x 版本中使用了相同的类。另外,我应该提到测试在安装了较旧 PHPUnit 的类似但较旧的 VM 上正确运行。
【问题讨论】:
标签: cakephp phpunit composer-php