在zend服务器上安装phpunit

时间:2012-11-19 09:46:06

标签: unit-testing zend-framework phpunit zend-server

大家好我已经对这个问题进行了很多相关的问题,但我仍然无法得到解决方案。我已经安装了Zend Server。现在我要安装PHPunit。我安装了pear,然后安装了PHPUnit

My Zend Server安装在

C:\xyz\zend\ZendServer

我的梨安装在

C:\xyz\zend\ZendServer\bin\PEAR

PHPunit安装在

C:\xyz\zend\ZendServer\bin\PEAR\pear\PHPUnit

我已将pear路径甚至PHPUnit路径添加到Envrionmental PATH变量。然后我打开了位于

php.ini
C:\xyz\zend\ZendServer\etc

并将include_path设置为

include_path = ".;c:\php\includes;c:\xyz\zend\ZendServer\bin\PEAR\pear;c:\xyz\zend\ZendServer\bin\PEAR\pear\PHPUnit"

现在当我在cmd运行命令创建zend项目时,项目已创建,但我也发现了这个注释

Testing Note: PHPUnit was not found in your include_path, therefore no testing action will be created.

有人请告诉我,我做错了什么,在哪里设置这个包括路径???

最诚挚的问候: - )

1 个答案:

答案 0 :(得分:2)

让我们做一些旧学校调试:)

$ zf create project ./one
Creating project at /path/to/one
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.

没有PHPUnit!

找到path/zend-framework/bin/zf.php并添加到顶部附近:

var_dump(get_include_path());

现在让我们看看包含路径是什么样的:

$ zf create project ./two
string(32) ".:/usr/share/php"
Creating project at /path/to/two
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created

我的PHPUnit不在/usr/share/php目录中。让我们通过将PHPUnit添加到包含路径来解决这个问题。

e.g。如果PHPUnit在/path/to/phpunit中,请打开php.ini文件并将其添加到包含路径。

第三次魅力:

$ zf create project ./three
string(56) ".:/usr/share/php:/path/to/phpunit"
Creating project at /path/to/three
Note: This command created a web project, for more information setting up your VHOST, please see docs/README

如果您编辑了正确的php.ini,那么您添加到var_dump()的{​​{1}}现在将回显包含路径以及您修改它的内容,在我的情况下它是正确的,现在PHPUnit正在运行。

现在从zf.php

中删除调试代码