的名稱文件我下面Jon´s screencast about Unit Testing with PhpUnit and ZF當我在這個question ratzip描述的完全相同的錯誤。PHPUnit的引發異常時,不會找到測試套件
正如他評論的那樣,即使在創建測試後,我也有同樣的問題,建議here:出於某種原因,有一些腳本尋找一個名爲我命名我的測試套件(MyApp.php或其他什麼)的文件... )。
我環顧四周,但wasn't能找到我應該創建這個文件,包含必要內容。
但是,在某時某刻,後讀了這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>
即使它似乎有點絕望,這個錯誤不是發生了現在的測試工作。
,但我感覺unconfortable它,因爲我無法理解之前,爲什麼這種明晰的「固定」它的文件是什麼問題。
我想不通爲什麼XML目錄定義是不能夠引導測試框架找到現有的測試。
TXS @edorian ,指向額外的'S'...這可能是我的問題的一部分... 我也發現了一些其他技巧在答案很相似的問題在http://stackoverflow.com/questions/7045834/ why-does-phpunit-try-to-find-a-file-name-of-the-testsuite 創建了一個「/tests/TheSuiteNameTest.php」,將該套件命名爲TheSuiteName,並將th e錯誤消失了...... – 2012-03-15 00:42:25
@RodrigoAoCubo你應該**不需要**「TestSuiteName.php」或類似的東西了。這在當天被用於編排測試套件,但已被xml配置取代。 – edorian 2012-03-15 08:42:49
你說得對,我已經刪除了「TestSuitName」。php「文件,它現在仍然可以工作,我沒有那個尾隨的's'。 – 2012-03-16 01:29:50