Skip to content
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

PHP settings not recognized when using process isolation #1013

Closed
mburtscher opened this issue Sep 30, 2013 · 3 comments
Closed

PHP settings not recognized when using process isolation #1013

mburtscher opened this issue Sep 30, 2013 · 3 comments

Comments

@mburtscher
Copy link

I configured some $_SERVER variables to be set for tests using the XML file:

<phpunit>
  <php>
    <server name="SERVER_PORT" value="80" />
  </php>
</phpunit>

Works fine but not with process isolation. When marking a test with @runInSeparateProcess I get an "Undefined index: SERVER_PORT" error.

@mburtscher
Copy link
Author

@sebastianbergmann

I Just realized that this is just the case when I want to use $_SERVER["SERVER_PORT"] in the bootstrap file. This is the case because the application bootstrapper depends on some environment variables being set.

When the template for an isolated test is created, the bootstrapper is called before global variables are set.

While this is not a bug in general, it's kind of strange since it causes a different behavior when using process isolation (globals set after bootstrapper) or not (globals set before bootstrapper).

Since I'm not aware of possible side-effects when changing this behavior I wanted to get your opinion on this before trying to create a pull-request.

@whatthejeff
Copy link
Contributor

Thanks for the bug report, @mburtscher. This is actually a duplicate of #757. Unfortunately, changing the order of events will cause regressions in #17. What might work, though, is to keep track of the values set in the <php> configuration and add those before files are included during process isolation.

@kyale
Copy link

kyale commented Sep 30, 2015

The related issue #757 has nothing to to with the issue described above. I have a fix for this issue and would like to submit a pull request.

sebastianbergmann pushed a commit that referenced this issue Oct 2, 2015
…alue configured in configuration xml to be lost when test is ran in isolation and preserve globals is disabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants