【发布时间】:2012-03-30 02:42:30
【问题描述】:
我在关注Jon´s screencast about Unit Testing with PhpUnit and ZF 时遇到了与此question 中描述的ratzip 完全相同的错误。
正如他所评论的那样,即使在按照here 的建议创建测试之后,我也遇到了同样的问题:出于某种原因,有一些脚本正在寻找一个名为我命名我的测试套件的文件(MyApp.php 或其他...... .).
我环顾四周,但找不到我应该在哪里创建这个文件以及它应该包含什么。
但是,在某个特定的时刻,在阅读了这个question about how to run a specific phpunit xml testsuite 之后,我决定尝试在测试套件部分显式地插入一个文件。
我的 phpunit.xml 现在是:
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuites>
<testsuite name="MyApp">
<file>./application/(path_to_model_inside_module)/ModelTests.php</file>
<directory>./</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../application/</directory>
<exclude>
<directory suffix=".phtml">../application/</directory>
</exclude>
</whitelist>
</filter>
即使看起来有点绝望,那个错误也不会再发生了,测试现在开始了。
但是我对此感到不舒服,因为我不明白之前的问题是什么,以及为什么这个文件的显式“修复”了它。
我不明白为什么 xml 目录定义不能引导测试框架找到现有的测试。
【问题讨论】:
标签: php zend-framework phpunit test-suite