XDebug With PHPUnit

Is this possible? I mean, when I try it using the Listen button, I get

Cannot accept external XDebug connection

Cannot evaluate expression

13 comments

Ok, that error was because I had a bug in my code (a fatal error.) Still, when I take it out, I get this;

E_NOTICE: Undefined index: SERVER_PORT
#0 xdebug eval(1)

And it does not work.

0

Hello Keith,

"Listen" button related functionality are based on evaluation of $_SERVER['SERVER_NAME'] and $_SERVER['SERVER_PORT'] variables, so this variables aren't accesible when running php as CLI.
I suppose that you can use 'PHP Remote Debug' run configuration for that.

Thank you!

0

As I've stated before, that adds complication to the process that I am not willing to mess with (can't seem to make it work reliably anyway.)

What if I manually generate those variables (I'm already doing that in my bootstrap files to make other things work)?

0

Keith,

What if I manually generate those variables (I'm already doing that in my bootstrap files to make other things work)

Yes, it should work in this way. You should generate these variables:   $_SERVER['SERVER_NAME']", $_SERVER['SERVER_PORT']" and  $_SERVER['REQUEST_URI'].
You can generate any value for $_SERVER['REQUEST_URI'] because it doen't have any important sense.

Please report here about results.

0

Keith,

Cannot accept external XDebug connection

Cannot evaluate expression

It is a bug and should be:

Cannot accept external XDebug connection

Cannot evaluate expression {expression here}

Fixed in the next EAP.

Thank you for feedback!

0

I guess I'm confused. What should those variable values be?

0

So, are you saying that until this is fixed, there is no way to run XDebug with PHPUnit? I can't get it to work.

0

Of course, right after I post. I figured out, don't hit SHIFT-ENTER, just ENTER and it works.

0

Hello Keith,

So, are you saying that until this is fixed, there is no way to run XDebug with PHPUnit? I can't get it to work.

No, it is just UI issue. Also you can use PHP Unit run configuration.

0

Hello Keith,

Sorry for delay!

I guess I'm confused. What should those variable values be?

For example:
$_SERVER['SERVER_NAME'] = 'localhost'
$_SERVER['SERVER_PORT'] = port
$_SERVER['REQUEST_URI'] = '/'

0

I knew that, I mean what the values were supposed to be. I was already setting SERVER_NAME and SERVER_PORT for my own code. Now, I'm guessing it doesn't matter.

0

Keith,

I knew that, I mean what the values were supposed to be.


PhpStorm use values of this variables for getting path mappings settings when you use 'Listen' button.

If you want to imitate web server you can set any values for this variables(the only restriction is that SERVER_PORT should have integer value).

0

Please sign in to leave a comment.