phpunit - 找不到类 PHPUnit_Testframework_TestCase
问题描述
我正在尝试使用 Xdebug/phpStorm 来测试 Drupal 项目。安装似乎工作(经过相当多的工作!)。但是,在 phpStorm 中设置断点并执行“运行”时,出现错误
PHP Fatal error: Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in /home/hs/hellm/vendor/albertofem/rsync-lib/tests/AFM/Rsync/Tests/CommandTest.php:16
Stack trace:
#0 /home/hs/hellm/vendor/phpunit/phpunit/src/Util/FileLoader.php(65): include_once()
#1 /home/hs/hellm/vendor/phpunit/phpunit/src/Util/FileLoader.php(49): PHPUnit\Util\FileLoader::load()
#2 /home/hs/hellm/vendor/phpunit/phpunit/src/Framework/TestSuite.php(402): PHPUnit\Util\FileLoader::checkAndLoad()
#3 /home/hs/hellm/vendor/phpunit/phpunit/src/Framework/TestSuite.php(530): PHPUnit\Framework\TestSuite->addTestFile()
#4 /home/hs/hellm/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php(98): PHPUnit\Framework\TestSuite->addTestFiles()
#5 /home/hs/hellm/vendor/phpunit/phpunit/src/TextUI/Command.php(120): PHPUnit\Runner\BaseTestRunner->getTest()
#6 /home/hs/hellm/vendor/phpunit/phpunit/src/TextUI/Command.php(96): PHPUnit\TextUI\Command->run()
#7 /home/hs/hellm/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#8 {main}
我在 PHP 7.4,使用 PHPUnit 9.5.4,Drupal 9.1.8
解决方案
PHPUnit 9 没有PHPUnit_Framework_TestCase
了。您的测试可能是为不再支持的过时版本的 PHPUnit 编写的。
推荐阅读
- multithreading - 使用运行空间池和 begininvoke 时如何收集返回值数据?
- rest - REST API 将文件从 S3 传递到客户端
- javascript - 如何在旋转之前计算图像容器(画布)内裁剪区域的顶部和左侧偏移量?
- java - 特殊开关盒初始化工作,但为什么?Java SwitchCase
- jekyll - jekyll:如何首先/从永久链接中删除
- asp.net - 模型中的日期不显示在 TextBoxFor 中
- python-3.x - 如何使用每列的单独排序函数在多列上对 Pandas DataFrame 进行排序
- heroku - rails 6 heroku资产预编译在生产中不起作用
- html - 在 SVG 上悬停时显示文本时出现问题
- css - 如何强制具有固定纵横比的 youtube iframe 始终留在容器内?