【发布时间】:2015-07-17 18:21:17
【问题描述】:
我的 zendframework 项目中有以下视图助手的目录结构
--application
--views
--helpers
--Test.php
application.ini 中的配置设置是
resources.view.helperPath = APPLICATION_PATH "/views/helpers"
Bootstrap.php 中的配置是
$view->setHelperPath(APPLICATION_PATH . "/views/helpers/");
在Test.php文件中的命名约定是
class Zend_View_Helper_Test extends Zend_View_Helper_Abstract {}
并且我在需要的地方在模块中使用辅助函数。当我通过浏览器运行项目时,应用程序工作正常而没有任何错误,但是当我通过命令行为同一个应用程序调用 phpunit 时,我收到类似的错误
Fatal error: Uncaught exception 'ErrorException' with message 'include_once(Zend\View\Helper\Test.php): failed to open stream: No such file or directory' in D:\
zend\ZendServer\share\ZendFramework-1.12.11\library\Zend\Loader.php:134
这意味着它将在 zend 服务器库视图文件夹中找到 Test.php 文件。我不明白为什么它可以通过浏览器工作,而不能通过命令行在 phpunit 中工作。
【问题讨论】:
-
你能分享一下你用来运行 PHPUnit 的命令和配置文件吗?您使用的是哪个版本的 PHPUnit?
-
命令:phpunit -c phpunit.xml, phpunit 版本是3.7.21 ....