【发布时间】:2011-11-10 06:44:54
【问题描述】:
我正在关注ZendCast 在 Zend 框架之上编写单元测试。在视频和其他一些来源之间,我的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?)
-
是的,你能把文件放到github上吗?
-
@Tim:不幸的是,不,我不能。呸!当一个人在自己的东西上工作时,这很容易问:P
标签: php zend-framework phpunit