Passed
Push — main ( 9c59f2...5fac80 )
by Peter
02:52
created

SecretGeneratorBootstrapperTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 2

2 Methods

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