GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

EnvVarsSetterTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testEnvFileIsNotFoundWithWrongEnv() 0 4 1
A setUp() 0 7 1
A testEnvFileIsFoundWithEnv() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Created by PhpStorm.
6
 * User: benjamin
7
 * Date: 26/01/19
8
 * Time: 12:10.
9
 */
10
11
namespace Tests\Lib\Env;
12
13
use Lib\Env\EnvVarsSetter;
14
use Lib\Env\Parser\DotenvParser;
15
use PHPUnit\Framework\MockObject\MockObject;
16
use PHPUnit\Framework\TestCase;
17
18
class EnvVarsSetterTest extends TestCase
19
{
20
    /** @var DotenvParser|MockObject */
21
    private $parser;
22
23
    /** @var EnvVarsSetter */
24
    private $setter;
25
26
    private $envPath = './tests/fixtures/.env';
27
28
    public function setUp()
29
    {
30
        $this->parser = $this->getMockBuilder(DotenvParser::class)
31
            ->setMethods(['parse'])
32
            ->getMock();
33
        $this->parser->/** @scrutinizer ignore-call */method('parse')->willReturn(['TEST_FOO' => 'foo']);
34
        $this->setter = new EnvVarsSetter($this->parser);
35
    }
36
37
    public function testEnvFileIsNotFoundWithWrongEnv()
38
    {
39
        $this->setter->loadEnv($this->envPath);
40
        $this->assertFalse(getenv('TEST_BAR'));
41
    }
42
43
    public function testEnvFileIsFoundWithEnv()
44
    {
45
        $this->setter->loadEnv($this->envPath, 'APP_ENV', 'test');
46
        $this->assertEquals('foo', getenv('TEST_FOO'));
47
    }
48
}
49