While debugging test class (child class of PHPUnit_Framework_TestCase) in PhpStorm it stops on breakpoints that are set in this class, but not stopping in controller (Symfony) that request point to.
//test class - here debugger stops
class FooControllerTest extends \PHPUnit_Framework_TestCase
{
public function testPOST()
{
$response = $this->client->post('/api/foo', [
'body' => json_encode($data)
]);
.
//controller - here debugger not stopping
/**
* @Route("/api/foo")
* @Method("POST")
*/
public function newAction(Request $request)
{
//...
return new Response($json, 201, array(
'Content-Type' => 'application/json'
));
Request enters to this controller for sure, because I can change http code there and this change is readable in test class after client->post( line
How to debug controller while testing?
xdebug.remote_autostart=1). Not ideal in other situations, obviously. Or add xdebug cookie or GET parameter to such request. Can also try placingxdebug_break();in actual code -- should work. - LazyOnexdebug.remote_autostart=1andxdebug_break();after increased number of simultaneous session not worked. I will add it as an answer, You can copy my answer to Your if you care about points (then I will remove my) - Sruj