Passed
Push — main ( 3b40c1...b711d3 )
by Peter
07:24
created

SecurityBootstrapperTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace AbterPhp\Framework\Bootstrappers\Http\Middleware;
4
5
use AbterPhp\Framework\Constant\Env;
6
use AbterPhp\Framework\Environments\Environment;
7
use AbterPhp\Framework\Http\Middleware\Security;
8
use Opulence\Cache\ICacheBridge;
9
use Opulence\Ioc\Container;
10
use PHPUnit\Framework\TestCase;
11
12
class SecurityBootstrapperTest extends TestCase
13
{
14
    /** @var SecurityBootstrapper */
15
    protected SecurityBootstrapper $sut;
16
17
    public function setUp(): void
18
    {
19
        $this->sut = new SecurityBootstrapper();
20
    }
21
22
    protected function tearDown(): void
23
    {
24
        Environment::unsetVar(Env::ENV_NAME);
25
    }
26
27
    public function testRegisterBindings()
28
    {
29
        Environment::setVar(Env::ENV_NAME, 'foo');
30
31
        $cacheBridgeMock = $this->getMockBuilder(ICacheBridge::class)->getMock();
32
33
        $container = new Container();
34
        $container->bindInstance(ICacheBridge::class, $cacheBridgeMock);
35
36
        $this->sut->registerBindings($container);
37
38
        $actual = $container->resolve(Security::class);
39
        $this->assertInstanceOf(Security::class, $actual);
40
    }
41
}
42