【问题标题】:How to use group in phpunit?如何在phpunit中使用组?
【发布时间】:2015-07-16 03:15:02
【问题描述】:

如何明智地为 zendframework 模块组调用 phpunit。我的意思是,当您调用 phpunit 时,它会先调用 module1,然后再调用 module2,依此类推。

【问题讨论】:

  • 我在 phpunit.xml 文件中配置了 ./application/modules/ 以便它为随机选择的模块调用 phpunit
  • 简单地列出你的模块,比如<directory>./application/modules/module1</directory>然后<directory>./application/modules/module2</directory>然后是另一个<directory>./application/modules/</directory>
  • 谢谢马托。它工作正常。你会帮我解决以下问题吗?致命错误:未捕获的异常 'ErrorException' 带有消息 'include_once(Zend\View\Helper\Approval.php): 无法打开流:没有这样的文件或目录' end\ZendServer\share\ZendFramework-1.12.11\library\Zend \Loader.php:134 我在通过命令行调用 phpunit 时遇到了这个错误,尽管我已经在包含路径中包含了这个目录
  • 嗨@Yogesh 似乎是一个类加载问题,您是否在 phpunit.xml 文件中指定了正确的引导值?我对zend不太熟悉试试看this的文章。
  • 嗨,Matteo,我给了 grp1、grp2、grp3 等组...此外,我还创建了批处理文件来运行 phpunit,其中我写了命令 @echo off phpunit --group grp1,grp2 --配置phpunit.xml,我运行批处理文件,它执行unittest group wise,例如grp1,grp2,grp3。同样的事情在我的另一个项目中不起作用,它按模块名称的字母顺序运行。应该是什么问题?

标签: zend-framework phpunit


【解决方案1】:

您可以简单地归档您的问题,只需按顺序列出您的模块,例如:

phpunit.xml

.....
<directory>./application/modules/module1</directory>
<directory>./application/modules/module2</directory> 
<directory>./application/modules/</directory>   
.....

关于类加载问题,请尝试查看this 文章。

还有here在评论中讨论类加载问题(和解决方案)。

希望有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-30
    • 2019-11-17
    • 1970-01-01
    • 1970-01-01
    • 2020-03-29
    相关资源
    最近更新 更多