Zend framework PhpUnit+;Zend framework-application.config.php:无法打开流

Zend framework PhpUnit+;Zend framework-application.config.php:无法打开流,zend-framework,phpunit,Zend Framework,Phpunit,我只是在用Zend框架做一些示例。正如官方教程所说,我创建了一个相册模块。它工作得很好。 现在我想在这个模块中添加Unti测试。 我正在使用此指南: 但是在“一个失败的测试用例”一章,我得到了一个不同的错误 C:\wamp\www\zf2 tutorial\module\Album\test>phpunit phpunit 3.7.19 by 塞巴斯蒂安·伯格曼 从中读取的配置 C:\wamp\www\zf2 tutorial\module\Album\test\phpunit.xml ←[31

我只是在用Zend框架做一些示例。正如官方教程所说,我创建了一个相册模块。它工作得很好。 现在我想在这个模块中添加Unti测试。 我正在使用此指南: 但是在“一个失败的测试用例”一章,我得到了一个不同的错误

C:\wamp\www\zf2 tutorial\module\Album\test>phpunit phpunit 3.7.19 by 塞巴斯蒂安·伯格曼

从中读取的配置 C:\wamp\www\zf2 tutorial\module\Album\test\phpunit.xml

←[31;1mE←[0m

时间:0秒,内存:8.75Mb

有1个错误:

(一) AlbumTest\Controller\AlbumControllerTest::TestIndexAction可以访问 include(/var/www/zf2 tutorial/config/application.config.php):失败 要打开str eam:没有这样的文件或目录

C:\wamp\www\zf2 tutorial\module\Album\test\AlbumTest\Controller\IndexControllerT est.php:14 C:\wamp\www\zf2 tutorial\module\Album\test\AlbumTest\Controller\IndexControllerT est.php:14

←[37;41m←[2]失败!←[0m←[37;41m←[2K测试:1,断言:0,错误: 1.←[0m←[2K

这里可能有什么问题?我正在寻找解决方案,但还没有找到解决这个问题的方法


(对不起我的英语)

显然路径是错误的

输出显示“从C:\wamp\www\zf2 tutorial\module\Album\test\phpunit.xml读取配置”,但错误消息抱怨未找到“/var/www/zf2 tutorial/config/application.config.php”

因此,解决方案是在
AlbumControllerTest

$this->setApplicationConfig(
    include '/var/www/zf2-tutorial/config/application.config.php'
);

或者更好(未经测试):


哇…这真是太尴尬了,因为我几个小时前就有了这个想法,但不知怎么的没有尝试过…顺便说一句,答案是thx!不客气。顺便说一句:如果答案确实解决了你的问题,如果你将其标记为“接受答案”,我将不胜感激(请确保他的最后一个解决方案有效)。如果你部署到linux服务器,你的C:\路径将失败
$this->setApplicationConfig(
    include 'C:/wamp/www/zf2-tutorial/config/application.config.php'
);
$this->setApplicationConfig(
    include APPLICATION_PATH . '/../config/application.config.php'
);