我正在关注在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上的文件? –