Skip to content

[PhpUnitBridge] display the command being executed #21083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Dec 28, 2016

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

If you want to pass environment variables to your tests (for example, to make use of Xdebug), you need to execute the actual process being run by the PHPUnit bridge wrapper. Displaying the commands being executed makes it easier to run them yourself (see also a previous discussion in #18898).

If you want to pass environment variables to your tests (for example, to
make use of Xdebug), you need to execute the actual process being run by
the PHPUnit bridge wrapper. Displaying the commands being executed makes
it easier to run them yourself.
@nicolas-grekas
Copy link
Member

but env vars are propagated to the subprocess, aren't they?

@xabbuh
Copy link
Member Author

xabbuh commented Dec 28, 2016

Maybe I am doing something completely wrong, but for me it did not behave that way.

@linaori
Copy link
Contributor

linaori commented Dec 28, 2016

Maybe this behavior is OS dep? Though I thought this was default behavior of php.

@xabbuh
Copy link
Member Author

xabbuh commented Dec 29, 2016

I investigated this a bit further. The issue does not seem to be that the environment variable is not inherited by the child process, but that Xdebug somehow does not work within the subprocess (maybe because there is still an open connection inside the parent process that blocks the child process from establishing the connection?). In any case, being able to easily figure out what command is actually executed helps to run this very command on your own.

@julienfalque
Copy link
Contributor

julienfalque commented Dec 29, 2016

I experienced the same problem.

I'm not sure it's the best solution but on my setup the extension is not loaded at all for CLI to avoid slowing down PHP commands. When I want to debug a script, I run it with php -dzend_extension=xdebug.so .... This works pretty well unless the script is in a child process, like with simple-phpunit.

I don't think a fix is possible for my use case because, as far as I know, there is no way to detect this runtime configuration to forward it to the child process. But displaying the command so I can run it manually will definitely help.

@nicolas-grekas
Copy link
Member

an alternative idea could be to not call a sub process but continue in the same for the simple case where no concurrency is involved, if possible

@xabbuh
Copy link
Member Author

xabbuh commented Dec 31, 2016

@nicolas-grekas That's indeed a good idea and it seems to work as expected (see #21112).

@xabbuh xabbuh modified the milestones: 3.3, 3.x Dec 31, 2016
@nicolas-grekas
Copy link
Member

Closing in favor of #21112

@xabbuh xabbuh deleted the phpunit-bridge-display-cmd branch January 2, 2017 16:48
fabpot added a commit that referenced this pull request Jan 2, 2017
This PR was merged into the 3.3-dev branch.

Discussion
----------

[PhpUnitBridge] run PHPUnit in the same process

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21083
| License       | MIT
| Doc PR        |

Commits
-------

1986278 [PhpUnitBridge] run PHPUnit in the same process
@nicolas-grekas nicolas-grekas modified the milestone: 3.x Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants