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

bootstrap doesn't have globals set when "--bootstrap" is specified in command line #1216

Nikoms opened this issue Apr 7, 2014 · 0 comments


Copy link

commented Apr 7, 2014

I have a phpunit.xml with bootstrap and some global variables set.

When I'm running "phpunit" without argument, my bootstrap.php has globals var set.

But when I run "phpunit --bootstrap test/bootstrap.php" (which is exactly the same file), none of the globals are set.

Here is my phpunit.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="test/bootstrap.php">
        <env name="foo" value="bar"/>
        <testsuite name="My Test Suite">

And my bootstrap.php:

logBoostrap(implode(' ', $_SERVER['argv']) . ':' );
logBoostrap( print_R($_ENV,true));

function logBoostrap($message){
    $logFile = __DIR__ .'/bootstrap.txt';
    file_put_contents($logFile, $message . PHP_EOL, FILE_APPEND);

I have a pull request ready for this, but I wanted to know if it was a normal behavior or an issue?


Nikoms added a commit to Nikoms/phpunit that referenced this issue May 3, 2014
@sebastianbergmann sebastianbergmann added this to the PHPUnit 4.3 milestone Oct 6, 2014
nicolas-grekas added a commit to symfony/symfony that referenced this issue Mar 23, 2016
…ATIONS_HELPER (nicolas-grekas)

This PR was merged into the 3.1-dev branch.


[Bridge\PhpUnit] Add "disabled" mode to SYMFONY_DEPRECATIONS_HELPER

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


Because we keep adding features to the bridge, so that one could want some features but not the deprecations helper.
In weak mode, this PR also disables colors.
Fetching the SYMFONY_DEPRECATIONS_HELPER env var is also done lazily to workaround old phpunit versions affected by sebastianbergmann/phpunit#1216


64fe539 [Bridge\PhpUnit] Add "disabled" mode to SYMFONY_DEPRECATIONS_HELPER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.