GenerateKeysBootstrapperTest::tearDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Bootstrappers\Console\Commands\Oauth2;
6
7
use AbterPhp\Framework\Console\Commands\Oauth2\GenerateKeys;
8
use AbterPhp\Framework\Constant\Env;
9
use AbterPhp\Framework\Environments\Environment;
10
use Opulence\Ioc\Container;
11
use PHPUnit\Framework\TestCase;
12
13
class GenerateKeysBootstrapperTest extends TestCase
14
{
15
    /** @var GenerateKeysBootstrapper - System Under Test */
16
    protected GenerateKeysBootstrapper $sut;
17
18
    public function setUp(): void
19
    {
20
        $this->sut = new GenerateKeysBootstrapper();
21
    }
22
23
    protected function tearDown(): void
24
    {
25
        Environment::unsetVar(Env::OAUTH2_PRIVATE_KEY_PASSWORD);
26
        Environment::unsetVar(Env::OAUTH2_PRIVATE_KEY_PATH);
27
        Environment::unsetVar(Env::OAUTH2_PUBLIC_KEY_PATH);
28
    }
29
30
    public function testRegisterBindings(): void
31
    {
32
        Environment::setVar(Env::OAUTH2_PRIVATE_KEY_PASSWORD, 'foo');
33
        Environment::setVar(Env::OAUTH2_PRIVATE_KEY_PATH, 'bar');
34
        Environment::setVar(Env::OAUTH2_PUBLIC_KEY_PATH, 'baz');
35
36
        $container = new Container();
37
38
        $this->sut->registerBindings($container);
39
40
        $actual = $container->resolve(GenerateKeys::class);
41
        $this->assertInstanceOf(GenerateKeys::class, $actual);
42
    }
43
}
44