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 does not contain env options defined in phpunit.xml #277

Closed
makasim opened this issue Jun 20, 2011 · 7 comments
Closed

bootstrap does not contain env options defined in phpunit.xml #277

makasim opened this issue Jun 20, 2011 · 7 comments

Comments

@makasim
Copy link
Contributor

makasim commented Jun 20, 2011

I tried to define APPLICATION_ENV option in the phpunit.xml file:

<phpunit>

     ...

     <php>
         <env name="APPLICATION_ENV" value="test"/>
     </php>
</phpunit>

And found out that this option wouldn't avaliable in bootsrap.php:

var_dump($_ENV);
// array(0) {
//}

but but perfectly exist in the test.

class FooTest extends PHPUnit_Framework_TestCase
{
    public function testFoo()
    {
        var_dumP($_ENV);
        //array(1) {
        //  ["APPLICATION_ENV"]=>
        //  string(4) "test"
        // }

    }
}

can you comment on this behavior because for me it seems right to have those options in bootstrap.php

@edorian
Copy link
Sponsor Contributor

edorian commented Nov 10, 2011

This works (for me at least) with PHPUnit 3.6.2 so I'll just to ahead and close this. Dumping $_ENV shows me all the env options defined for me CLI envinroment and also that I've added to the xml config.

If that doesn't still work out for you feel free to reopen and maybe add a small reproduce if you can.

@edorian edorian closed this as completed Nov 10, 2011
@rejsmont
Copy link

Actually I am experiencing this as well with PHPUnit 3.7.20 running on php 5.3.10-1ubuntu3.6. I do not experience that with php running on OS X. I guess this might be platform-specific.

In phpunit.xml:

<php>
        <env name="BOOTSTRAP_CLEAR_CACHE_ENV" value="test"/>
        <env name="BOOTSTRAP_DROP_DB_ENV" value="test"/>
        <env name="BOOTSTRAP_CREATE_DB_ENV" value="test"/>
        <env name="BOOTSTRAP_LOAD_FIXTURES_ENV" value="test"/>
</php>

In bootstrap.php:

var_dump($_ENV);
// array(0) {
//}

@whatthejeff whatthejeff reopened this May 17, 2013
@whatthejeff
Copy link
Contributor

The problem occurs when auto-globals-jit is enabled because the implementation of this feature make use of variable variables. I'll provide a fix for this shortly.

@kanduvisla
Copy link

I'm experiencing this issue in PHPUnit 4.5.0

@rdohms
Copy link
Contributor

rdohms commented Mar 14, 2016

I'm having this issue with PHPunit 5.2.11 installed via composer. Funny enough if i use a PHPunit 4.5 runtime (left over in /usr/local/bin) it will run saying "5.2.11" but will load vars.

@sebastianbergmann
Copy link
Owner

@rdohms Please open a new ticket that contains a minimal, self-contained, reproducing test case. Thanks!

@rdohms
Copy link
Contributor

rdohms commented Mar 14, 2016

ok, let me give it a try

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

7 participants