gpt4 book ai didi

PHPUnit 报告 PHPUnit_Framework_Exception

转载 作者:行者123 更新时间:2023-12-04 23:29:15 30 4
gpt4 key购买 nike

我在一个包中添加了一个简单的测试。

按照手册中的建议,我尝试让 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 的名称属性命名的文件

  • 如果是 找不到任何测试 (错误命名或错误目录)或
  • 如果有 fatal error 发生在测试脚本中;这发生得太早以至于 PHPUnit 无法将该文件的内容识别为测试 - 因为在此之前无法加载任何类。
  • 关于PHPUnit 报告 PHPUnit_Framework_Exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7553311/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com