3
我在PHPunit和zend框架中的代碼覆蓋率報告存在一些問題。每當我運行一個PHPUnit的測試代碼覆蓋率失敗,返回以下消息:代碼覆蓋失敗,PHPUnit和Zend框架
PHPUnit 3.4.15 by Sebastian Bergmann.
I.......III.I................................IIIIIIIIIIIIIII 60/93
IIII....I....I..II..II.....IIIIII
Time: 4 seconds, Memory: 22.25Mb
OK, but incomplete or skipped tests!
Tests: 93, Assertions: 174, Incomplete: 36.
Generating code coverage report, this may take a moment.PHP Fatal error: Cannot redeclare class Klunde_Auth in /Users/kristianlunde/workspaces/private/klunde/Library/Klunde/Auth.php on line 9
Fatal error: Cannot redeclare class Klunde_Auth in /Users/kristianlunde/workspaces/private/klunde/Library/Klunde/Auth.php on line 9
我phpunit.xml文件看起來像這樣:
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="Klunde">
<directory>./application/</directory>
<directory>./Library/Klunde</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../application</directory>
<directory suffix=".php">../Library/Klunde</directory>
<exclude>
<directory suffix=".phtml">../application/</directory>
<file>../application/Bootstrap.php</file>
<file>../application/controllers/ErrorController.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/report" charset="UTF-8" yui="true"
highlight="true" lowUpperBound="50" highLowerBound="80" />
<log type="testdox-html" target="./log/testdox.html" />
</logging>
</phpunit>
我在做了
var_dump(get_included_files());
Auth文件的頂部,它在失敗之前嘗試多次包含該文件。
我也嘗試刪除Klunde_Auth.php文件,以查看它是否是單個文件問題,但是在庫/ Klunde目錄中的下一個文件上觸發錯誤。
我運行OSX雪豹,用PHP 5.3.1,XDebug的2.1.0beta3和PHPUnit的3.4.15
所有幫助和援助將得到高度讚賞。
謝謝。
凹凸!這個問題解決了嗎?如果是這樣,我很好奇這個解決方案。 – 2011-07-05 17:26:39
@ Janis,我的確以某種方式解決了這個問題,但我真的不記得我爲解決問題所做的一切。你遇到同樣的問題嗎?如果需要,我可以看看我的解決方案。 – 2011-09-12 04:44:36