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 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看