GenerateKeysBootstrapperTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tearDown() 0 5 1
A testRegisterBindings() 0 12 1
A setUp() 0 3 1
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