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

Closed
Nikoms opened this issue Apr 7, 2014 · 0 comments
Milestone

Comments

@Nikoms
Copy link
Contributor

Nikoms commented Apr 7, 2014

Hello,
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">
    <php>
        <env name="foo" value="bar"/>
    </php>
    <testsuites>
        <testsuite name="My Test Suite">
            <directory>test</directory>
        </testsuite>
    </testsuites>
</phpunit>

And my bootstrap.php:

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


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?

Thanks!

Nikoms pushed 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.

Discussion
----------

[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        | -

See https://github.com/symfony/symfony/pull/18232/files?w=1

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

Commits
-------

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants