我想在使用phpunit文件时使用断点。我的项目是一个Symfony项目,我使用的是MAMP Pro 3.2.1
这是我的配置:
当我启动调试模式(在PhpStorm的顶部栏中有绿色错误)时,我会收到此输出:
/Applications/MAMP/bin/php/php5.6.7/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php --configuration "/Users/bob/Documents/Lavori Personali/webCamBundle/app/phpunit.xml.dist" Barno\WebcamBundle\Tests\Controller\WebcamControllerTest "/Users/bob/Documents/Lavori Personali/webCamBundle/src/Barno/WebcamBundle/Tests/Controller/WebcamControllerTest.php"
Testing started at 14:03 ...
Process finished with exit code 255
此外,如果我在代码中使用断点
我检查了文件中的错误,我发现了这个
[02-Jun-2015 14:26:57 Europe/Berlin] PHP Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php on line 49
[02-Jun-2015 14:26:57 Europe/Berlin] PHP Stack trace:
[02-Jun-2015 14:26:57 Europe/Berlin] PHP 1. {main}() /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php:0
[02-Jun-2015 14:26:57 Europe/Berlin] PHP 2. IDE_PHPUnit_Loader::init() /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php:209
[02-Jun-2015 14:26:57 Europe/Berlin] PHP 3. IDE_PHPUnit_Loader::detectPHPUnitVersionId() /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php:196
[02-Jun-2015 14:26:57 Europe/Berlin] PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Runner/Version.php' (include_path='.:/Applications/MAMP/bin/php/php5.6.7/lib/php') in /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php on line 49
[02-Jun-2015 14:26:57 Europe/Berlin] PHP Stack trace:
[02-Jun-2015 14:26:57 Europe/Berlin] PHP 1. {main}() /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php:0
[02-Jun-2015 14:26:57 Europe/Berlin] PHP 2. IDE_PHPUnit_Loader::init() /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php:209
[02-Jun-2015 14:26:57 Europe/Berlin] PHP 3. IDE_PHPUnit_Loader::detectPHPUnitVersionId() /private/var/folders/0h/tzk_113d4_lcd6rf_bzwjmhr0000gn/T/ide-phpunit.php:196
答案 0 :(得分:0)
安装xdebug模块
检查您使用的是哪个PHP版本
设置IDE设置
在终端中找到路径类型:$ which php
例如:/usr/local/Cellar/php56/5.6.5/bin/php
重启phpstorm
现在让它运作
运行>编辑配置>点击左侧的绿色+按钮>选择 php Web应用程序
name:any example ur {application name - debugger}
现在设置断点并单击debug