我正在關注在0123nd上編寫Zend Framework之上的單元測試。視頻和其他一些源之間,我phpunit.xml
如下所示:爲什麼PHPUnit不接受XML定義的測試套件?
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuites>
<testsuite name="RefreshTests">
<directory>./</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../application</directory>
</whitelist>
<exclude></exclude>
</filter>
<logging>
<log type="coverage-html" target="./log/report" charset="UTF-8"
yui="true" highlight="true" lowUpperBound="50" highLowerBound="80" />
<log type="testdox" target="./log/testdox.html" />
</logging>
</phpunit>
不幸的是,當我試圖用這個文件運行PHPUnit的,而我可以確認的是,「boostrap.php」文件並運行,我在運行時出現此錯誤:
PHPUnit_Framework_Exception:無法打開「RefreshTests.php」和「RefreshTests.php」。在線102上的C:\ Program Files(x86)\ php \ pear \ PHPUnit \ Util \ Skeleton \ Test.php
這似乎表明PHPUnit正在尋找一個基於我命名測試的文件以便找到要運行的測試,而不是尊重我希望將其運行在整個目錄中。儘管如此,PHPUnit's documentation quite explicitly says that defining a test suite this way is allowed.
我做了什麼不正確?
可能是Windows的問題。你使用的是什麼版本的phpunit?梨分佈可能已過時 –
錯誤看起來像測試的路徑不正確,或沒有測試可用(你有文件與前綴測試?,例如ClassTest.php?) – opHASnoNAME
是啊,你可以把github上的文件? –