目前我在使用 Yii 时遇到问题,当我使用“@group
注释”(PHPUnit 支持)来测试我的类中的组函数时 < strong>从 Yii 扩展。
我在Yii的论坛里配置成向导(NetBeans IDE and Yii projects) .
当我按下 Ctrl + F6 时,我已经测试了类里面的所有功能。 运行良好。
但是当我使用“@group
注释”(PHPUnit 支持)时。 它没有运行,我没有看到对话框。
当我在对话框中选中“在运行测试之前询问测试组”时,配置 PHPUnit。当我按下 Ctrl + F6 时,我没有看到对话框。
我认为这里的问题是两个文件“bootstrap.php”和“phpunit.php”,但我不知道如何改变它?
我对 Yii 论坛有疑问,demo code .
最佳答案
如何修改 bootstrap.php 或 phpunit.xml? 只需在您最喜欢的文本编辑器中打开,Netbeans 就足够了。至于这些文件的含义,引用phpunit documentation似乎有英语、法语和日语版本。
- bootstrap - A "bootstrap" PHP file that is run before the tests.
- configuration - If phpunit.xml or phpunit.xml.dist (in that order) exist in the current working directory and --configuration is not used, the configuration will be automatically read from that file.
如果您不需要 bootstrap.php,我不会担心它,您可能不需要它,我只想说,您可以添加任何内容来改善 Netbeans 中的行为。
关于 configuring groups phpunit 文档非常详尽:
The <groups> element and its <include>, <exclude>, and <group> children can be used to select groups of tests from a suite of tests that should (not) be run.
<groups> <include> <group>name</group> </include> <exclude> <group>name</group> </exclude> </groups>
The XML configuration above corresponds to invoking the TextUI test runner with the following switches:
--group name
--exclude-group name
同样,在 Ctrl+F6 用法方面,没有什么可以改进 netbeans,相反,我还建议您引用 Devin M's解释,正如@hakre 已经建议的那样,将其与 Netbeans - run test groups documentation 结合起来恐怕我还没有什么可以补充的,因为它已经完成了。
祝你好运,请告诉我们你的结果如何。
关于php - 不要在 Netbeans 中测试从 Yii 扩展的类的组(PHPUnit 支持@group 注释)功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9750453/