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 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试