SecretGeneratorBootstrapperTest::setUp()   A
last analyzed

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
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Bootstrappers\Console\Commands\Security;
6
7
use AbterPhp\Framework\Console\Commands\Security\SecretGenerator;
8
use Opulence\Events\Dispatchers\IEventDispatcher;
9
use Opulence\Ioc\Container;
10
use PHPUnit\Framework\TestCase;
11
12
class SecretGeneratorBootstrapperTest extends TestCase
13
{
14
    /** @var SecretGeneratorBootstrapper - System Under Test */
15
    protected SecretGeneratorBootstrapper $sut;
16
17
    public function setUp(): void
18
    {
19
        $this->sut = new SecretGeneratorBootstrapper();
20
    }
21
22
    public function testRegisterBindings(): void
23
    {
24
        $eventDispatchedMock = $this->getMockBuilder(IEventDispatcher::class)->getMock();
25
        $eventDispatchedMock->expects($this->once())->method('dispatch');
26
27
        $container = new Container();
28
        $container->bindInstance(IEventDispatcher::class, $eventDispatchedMock);
29
30
        $this->sut->registerBindings($container);
31
32
        $actual = $container->resolve(SecretGenerator::class);
33
        $this->assertInstanceOf(SecretGenerator::class, $actual);
34
    }
35
}
36