dtpt75860 2017-05-24 12:28
浏览 94
已采纳

测试配置失败 - PHPUnit,Symfony,PHPStorm,Phing

I have a backend system based on Symfony 3.x, and I work on PHPStorm 2017.x. My Server is a regular XAMPP 5.6.8 stack with Apache and MySQL only, and I applied the latest compatible phpunit.phar (5.7.20) to the "php"-folder in the XAMPP-directory. I am supposed to run PHPUnit tests with a Phing buildfile, however the internal PHPStorm terminal displays an error:

Fatal error: Class 'PHPUnit\Framework\TestCase' not found in O:\%PROJECT_DIR%\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php on line 25

In my current project settings, I pointed to the phpunit.phar within my XAMPP-directory, but somehow it still tries to find the phpunit within the Symfony vendor directory. Where exactly is the source of the error and how can I correct it? Is it Phing-based?

EDIT: Adding the error call stack:

Call Stack:
0.0003     121616   1. {main}() O:\xampp_5_6_8\php\phpunit:0
0.0064     357360   2. PHPUnit_TextUI_Command::main() O:\xampp_5_6_8\php\phpunit:46
0.0064     360760   3. PHPUnit_TextUI_Command->run() O:\xampp_5_6_8\php\pear\PHPUnit\TextUI\Command.php:129
0.0064     361968   4. PHPUnit_TextUI_Command->handleArguments() O:\xampp_5_6_8\php\pear\PHPUnit\TextUI\Command.php:138
0.0212     833056   5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() O:\xampp_5_6_8\php\pear\PHPUnit\TextUI\Command.php:657
0.0212     833720   6. PHPUnit_Util_Configuration->getTestSuite() O:\xampp_5_6_8\php\pear\PHPUnit\Util\Configuration.php:789
0.0609     976960   7. PHPUnit_Framework_TestSuite->addTestFiles() O:\xampp_5_6_8\php\pear\PHPUnit\Util\Configuration.php:873
0.0609     978088   8. PHPUnit_Framework_TestSuite->addTestFile() O:\xampp_5_6_8\php\pear\PHPUnit\Framework\TestSuite.php:416
0.0623    1033248   9. PHPUnit_Util_Fileloader::checkAndLoad() O:\xampp_5_6_8\php\pear\PHPUnit\Framework\TestSuite.php:355
0.0634    1033416  10. PHPUnit_Util_Fileloader::load() O:\xampp_5_6_8\php\pear\PHPUnit\Util\Fileloader.php:76
0.0642    1054496  11. include_once('O:\%PROJECT_DIR%\src\App\Bundle\Tests\Controller\ControllerTest.php') O:\xampp_5_6_8\php\pear\PHPUnit\Util\Fileloader.php:92
0.0643    1054728  12. spl_autoload_call() O:\xampp_5_6_8\php\pear\PHPUnit\Util\Fileloader.php:11
0.0643    1054784  13. Composer\Autoload\ClassLoader->loadClass() O:\xampp_5_6_8\php\pear\PHPUnit\Util\Fileloader.php:0
0.0647    1054960  14. Composer\Autoload\includeFile() O:\%PROJECT_DIR%\vendor\composer\ClassLoader.php:301
0.0653    1059352  15. include('O:\%PROJECT_DIR%\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\WebTestCase.php') O:\%PROJECT_DIR%\vendor\composer\ClassLoader.php:414
0.0653    1059592  16. spl_autoload_call() O:\%PROJECT_DIR%\vendor\composer\ClassLoader.php:22
0.0653    1059656  17. Composer\Autoload\ClassLoader->loadClass() O:\%PROJECT_DIR%\vendor\composer\ClassLoader.php:0
0.0657    1059832  18. Composer\Autoload\includeFile() O:\%PROJECT_DIR%\vendor\composer\ClassLoader.php:301
0.0664    1091728  19. include('O:\%PROJECT_DIR%\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php') O:\%PROJECT_DIR%\vendor\composer\ClassLoader.php:414
  • 写回答

1条回答 默认 最新

  • douzhunlan5930 2017-05-25 11:39
    关注

    PHPUnit\Framework\TestCase is a reference to PhpUnit 6 test version while you're using phpunit.phar (5.7.20). Try to replace it with the latest 6.* version.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵