sensiolabs / BehatPageObjectExtension

MIT License
117 stars 48 forks source link

Cannot debug page objects / elements with Xdebug #65

Closed elvetemedve closed 8 years ago

elvetemedve commented 8 years ago

I cannot execute code in page object classes step by step using Xdebug, because the 3rd party Proxy manager will replace my real classes with generated code like /tmp/ProxyManagerGeneratedProxy_PM_PageDummy2b00042f7481c7b056c4b410d28f33cf.php.

Replacing lazy factory with default factory does not help to resolve this. Is there a way to get rid of the proxy manager at least while I'm debugging my tests?

jakzal commented 8 years ago

Lazy factory is used when you inject page objects into your contexts via the constructor. There's no way around this, as at the time contexts are initialised not everything is bootstrapped yet.

@ocramius any way to make ocramius/proxy-manager working with xdebug?

Ocramius commented 8 years ago

You can actually step debug into temporary files: just set the proxy directory to be inside your project (if your IDE refuses to step into classes that are in temporary files): https://github.com/Ocramius/ProxyManager/blob/1.0.2/src/ProxyManager/Configuration.php#L143

jakzal commented 8 years ago

Cheers!

jakzal commented 8 years ago

@elvetemedve does it help you? We could make the path configurable, but is this a blocker for you? If not, it can be added after the stable release.

elvetemedve commented 8 years ago

@jakzal Yes, it does. Thanks. I managed to share the tmp directory of the web server with my development machine. After that it was possible to set up a path mapping for Xdebug which basically solved my problem.

If you could make the proxy directory configurable that would be an improvement.

It's not a blocker for me, so I don't think a hotfix is necessary. In a worst case scenario the good old var_dump() still can be used for debugging.

jakzal commented 8 years ago

Should be fixed by #70.