我在我的 ubuntu 上全新安装了 Zend Framework。我刚刚安装了 PHPUnit。我可以从终端使用它。一切正常。我在 apache 和 PHP CLI 使用的 php.ini 中手动添加了 PHPUnit 路径到 include_path。 Apache 重新启动没有任何问题。
但是如果我使用:zf.sh create project myproject
我得到信息:测试注意:在您的 include_path 中找不到 PHPUnit,因此不会创建任何测试操作。
我想我测试了我在互联网上找到的所有解决方案...请帮助我。
最佳答案
首先安装PHPUNIT 然后将PHPUnit 库放入php 包含路径。并在主目录中创建一个名为“.zf.ini”的文件并添加一行你的 php 包含路径 php.include_path=".:/usr/lib/php/pear"
为了使 zf 命令自动加载 phpunit 文件,在 zf.php 文件中添加以下函数
// For solving loading issue of PHPUNIT classs from pear folder
spl_autoload_register(function($class)
{
$file = str_replace('_','/',$class.'.php');
//Suppress errors in case it can't find the file.
@include_once $file;
});
我希望这能解决您的问题。
关于zend-framework - Ubuntu、zend framework 和 PHPUnit - 测试说明 : PHPUnit was not found in your include_path, 因此不会创建任何测试操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8971126/