getenv
laravel/framework
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Gets the value of an environment variable
getenv
(
string $varname
,
bool $local_only
=
false
):
string
|
false
(new
LoadEnvironmentVariables
)->
bootstrap
(
$this
->
getAppMock
(
'.env'
));
$this
->
assertSame
(
'BAR'
,
env
(
'FOO'
));
$this
->
assertSame
(
'BAR'
,
getenv
(
'FOO'
));
$this
->
assertSame
(
'BAR'
,
$_ENV
[
'FOO'
]);
$this
->
assertSame
(
'BAR'
,
$_SERVER
[
'FOO'
]);
}
tests/Foundation/Bootstrap/LoadEnvironmentVariablesTest.php
{
protected function
getEnvironmentSetUp
(
$app
)
{
if (
getenv
(
'DB_CONNECTION'
) !==
'testing'
) {
$this
->
markTestSkipped
(
'Test requires a Sqlite connection.'
);
}
tests/Integration/Database/Sqlite/DatabaseSqliteConnectionTest.php
{
protected function
getEnvironmentSetUp
(
$app
)
{
if (
getenv
(
'DB_CONNECTION'
) !==
'testing'
) {
$this
->
markTestSkipped
(
'Test requires a Sqlite connection.'
);
}
tests/Integration/Database/Sqlite/DatabaseSqliteSchemaBuilderTest.php
{
protected function
getEnvironmentSetUp
(
$app
)
{
if (
getenv
(
'DB_CONNECTION'
) !==
'testing'
) {
$this
->
markTestSkipped
(
'Test requires a Sqlite connection.'
);
}
tests/Integration/Database/Sqlite/EloquentModelConnectionsTest.php