我在一个包中添加了一个简单的测试。
按照手册中的建议,我尝试让 PHPUnit 加载配置:
phpunit -c /app
phpunit.xml 看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "false"
syntaxCheck = "false"
bootstrap = "bootstrap.php.cache" >
<testsuites>
<testsuite name="Project Test Suite">
<directory>../src/*Bundle/Tests</directory>
</testsuite>
</testsuites>
</phpunit>
我得到的错误信息是:
root@h0x03:/var/www/fi/FrontendIntegrator# phpunit -c app/
PHP Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "Project Test Suite.php" nor "Project Test Suite.php" could be opened.' in /usr/share/php/PHPUnit/Util/Skeleton/Test.php:102
Stack trace:
#0 /usr/share/php/PHPUnit/TextUI/Command.php(157): PHPUnit_Util_Skeleton_Test->__construct('Project Test Su...', '')
#1 /usr/share/php/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#2 /usr/bin/phpunit(49): PHPUnit_TextUI_Command::main()
#3 {main}
thrown in /usr/share/php/PHPUnit/Util/Skeleton/Test.php on line 102
PHPUnit 显然会加载该文件并尝试查找以测试套件名称命名的 PHP 文件。我找不到任何关于它为什么这样做或这样的文件应该是什么样子的信息。
最佳答案
似乎 PHPUnit 试图找到一个以 testsuite-tag 的名称属性命名的文件
关于PHPUnit 报告 PHPUnit_Framework_Exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7553311/