zend-framework - Ubuntu、zend framework 和 PHPUnit - 测试说明 : PHPUnit was not found in your include_path, 因此不会创建任何测试操作

标签 zend-framework ubuntu phpunit include-path

我在我的 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/

相关文章:

python - 如何打印包含一些俄语的 Pandas 数据框

phpunit - 当有大量异常时,为什么 phpunit 是绿色的?

zend-framework - Zend ACL 动态断言

php - Zend_Navigation 加载失败

bash - Ubuntu bash 脚本 - 搜索所有文件夹以运行视频转换

php - 是否可以模拟 protected 属性和方法

php - 如何测试 Laravel 5 工作?

php - Strato 服务器 PHP Zend PDOException 套接字

Php 包括 Zend 框架的路径帮助

安装后 Rstudio 未从 ubuntu 上的终端执行