0
votes

I'd like to use breakpoint when use phpunit file. My project is a Symfony project and I use MAMP Pro 3.2.1

This is my configuration:

enter image description here

When I launch the Debug mode ( with the green bug in the top bar of PhpStorm) I receive this output:

/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

Also if I use Breakpoint in my code

enter image description here

I checked the error on file and I found this

    [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
1
1) PhpStorm version? 2) PHPUnit version 3) PHPUnit installation type (Composer/PHAR/etc) ? - LazyOne
phpStorm 8.0.3 PHPUnit 4.3.5 via composer - monkeyUser
How did you configured PHPUnit in PhpStorm? Screenshots please. - LazyOne

1 Answers

0
votes
  • install xdebug module 

  • check which PHP version are you using

    • php --ini
  • setup the IDE settings

    • preference > languages and framework > PHP >
      • set the language level to the correct PHP version of this project
      • set an interpreter (set the parent directory of where the bin directory of PHP executable is loaded)
        • click the … button > click the + button > other local > set PHP Excitable path,   

to find the path type in the terminal: $ which php

example: /usr/local/Cellar/php56/5.6.5/bin/php

restart phpstorm

  • now let’s make it work

    • run > edit configuration > click the green + button on the left > select php web application

    • name: anything example ur {application name - debugger}

    • server: localhost (browse > + > name: whatever | host: localhost or 127.0.0.1)
    • click ok 
    • start url: the link of ur project homepage:    http://127.0.0.1:80/SomethingNew/
    • click ok
  • now set the break point and click debug