Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jun 1, 2020
1 parent 069beb1 commit 918681e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/ConversionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

use Env\Env;
use function Env\env;
use PHPUnit\Framework\TestCase;

class ConversionTest extends PHPUnit_Framework_TestCase
class ConversionTest extends TestCase
{
public function dataProvider(): array
{
Expand Down Expand Up @@ -35,7 +36,7 @@ public function testConversions(string $value, ?int $options, $expected)
$this->assertSame($expected, $result);
}

public function testEnv()
public function testFunction()
{
putenv('FOO=123');

Expand All @@ -56,24 +57,24 @@ public function testEnv()
$this->assertSame(123, env('FOO'));
}

public function testEnvGet()
public function testClass()
{
putenv('FOO=123');
putenv('BAR=123');

$this->assertSame(123, Env::get('FOO'));
$this->assertSame(123, Env::get('BAR'));

//Switch to $_ENV
Env::$options |= Env::USE_ENV_ARRAY;

$this->assertNull(Env::get('FOO'));
$this->assertNull(Env::get('BAR'));

$_ENV['FOO'] = 456;
$_ENV['BAR'] = 456;

$this->assertSame(456, Env::get('FOO'));
$this->assertSame(456, Env::get('BAR'));

//Switch to getenv again
Env::$options ^= Env::USE_ENV_ARRAY;

$this->assertSame(123, Env::get('FOO'));
$this->assertSame(123, Env::get('BAR'));
}
}

0 comments on commit 918681e

Please sign in to comment.