8000 bootstrap doesn't have globals set when "--bootstrap" is specified in command line · Issue #1216 · sebastianbergmann/phpunit · GitHub
[go: up one dir, main page]

Skip to content
bootstrap doesn't have globals set when "--bootstrap" is specified in command line #1216
@Nikoms

Description

@Nikoms

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0