Skip to content

Loading…

PHP_Timer issue if $_SERVER overwritten in unit tests #72

Closed
bonndan opened this Issue · 2 comments

3 participants

@bonndan

This is not really an issue, but if one overwrites $_SERVER with an empty array, PHPUnit registers an exception from PHP_Timer::timeSinceStartOfRequest() after running all tests. Thus, PHPUnit is dependent of this global variable (via PHP_Timer), which might not be the best design.

@whatthejeff
Collaborator

By default, PHPUnit actually backs up and restores $GLOBALS for each test. Is it possible that you are using the --no-globals-backup switch which prevents PHPUnit from restoring $_SERVER?

As a side note, I don't think this is necessarily bad design. I suspect that you would break almost any PHP application if you destroyed all the superglobals. More to the point, what is typically considered bad practice in PHP is modifying or destroying superglobals.

@sebastianbergmann

Closing.

@crabcz crabcz pushed a commit to crabcz/phpunit that referenced this issue
Mates Rak Fixes phpunit-selenium issue #72: ReflectionException when running se…
…lenese test.

This also applies to magical methods which have no accessible reflection
d1a954a
@edorian edorian added a commit that referenced this issue
Mates Rak Fixes phpunit-selenium issue #72: ReflectionException when running se…
…lenese test.

This also applies to magical methods which have no accessible reflection
980a13b
@greglamb greglamb pushed a commit to greglamb/phpunit that referenced this issue
Mates Rak Fixes phpunit-selenium issue #72: ReflectionException when running se…
…lenese test.

This also applies to magical methods which have no accessible reflection
6b1d9ee
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.