【问题标题】:installing phpunit on zend server在zend服务器上安装phpunit
【发布时间】:2012-11-07 05:17:47
【问题描述】:

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

我的 Zend 服务器安装在

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.

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

最好的问候 :-)

【问题讨论】:

  • 尝试在 Windows 中将 PHPUnit.bat 添加到您的系统路径
  • 您确定可以在C:\xyz\zend\ZendServer\bin\PEAR\pear 目录中找到PHPUnit 吗?如果您查看该目录,您应该会看到一个名为 PHPUnit 的目录,其中应该是 PHPUnit php src 文件。我问,因为 PHPUnit 在 bin 目录下是不寻常的。
  • @BullfrogBlues 是的,我很确定 :-)

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


【解决方案1】:

让我们做一些老式的调试:)

$ 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 添加到包含路径来解决这个问题。

例如如果 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,则添加到zf.phpvar_dump() 现在将使用您修改的任何内容来回显包含路径,在我的情况下它是正确的,所以现在 PHPUnit 正在工作.

现在从zf.php中删除调试代码

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-09
    相关资源
    最近更新 更多