unset($_SERVER['TEST_APP_DEBUG'
],
$_ENV['TEST_APP_DEBUG'
]);
unset($_SERVER['FOO'
],
$_ENV['FOO'
]);
$_ENV['EXISTING_KEY'
] =
$_SERVER['EXISTING_KEY'
] = 'EXISTING_VALUE';
};
@
mkdir($tmpdir =
sys_get_temp_dir().'/dotenv'
);
$path =
tempnam($tmpdir, 'sf-'
);
file_put_contents($path, "FOO=BAR\nEXISTING_KEY=NEW_VALUE"
);
$resetContext();
(new Dotenv('TEST_APP_ENV', 'TEST_APP_DEBUG'
))->
bootEnv($path);
$this->
assertSame('BAR',
$_SERVER['FOO'
]);
$this->
assertSame('EXISTING_VALUE',
$_SERVER['EXISTING_KEY'
]);
$resetContext();
(new Dotenv('TEST_APP_ENV', 'TEST_APP_DEBUG'
))->
bootEnv($path, 'dev',
['test'
], true
);
$this->
assertSame('BAR',
$_SERVER['FOO'
]);
$this->
assertSame('NEW_VALUE',
$_SERVER['EXISTING_KEY'
]);
unlink($path);
file_put_contents($path.'.local.php', '<?php return ["TEST_APP_ENV" => "dev", "FOO" => "BAR", "EXISTING_KEY" => "localphpNEW_VALUE"];'
);
$resetContext();
(