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

CasbinCombinedAdapterBootstrapperTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRegisterBindings() 0 13 1
A setUp() 0 3 1
1
<?php
2
3
namespace AbterPhp\Framework\Bootstrappers\Vendor;
4
5
use AbterPhp\Framework\Authorization\CacheManager;
6
use AbterPhp\Framework\Authorization\CombinedAdapter;
7
use CasbinAdapter\Database\Adapter;
8
use Opulence\Ioc\Container;
9
use PHPUnit\Framework\TestCase;
10
11
class CasbinCombinedAdapterBootstrapperTest extends TestCase
12
{
13
    /** @var CasbinCombinedAdapterBootstrapper */
14
    protected CasbinCombinedAdapterBootstrapper $sut;
15
16
    public function setUp(): void
17
    {
18
        $this->sut = new CasbinCombinedAdapterBootstrapper();
19
    }
20
21
    public function testRegisterBindings()
22
    {
23
        $cacheManagerMock = $this->getMockBuilder(CacheManager::class)->disableOriginalConstructor()->getMock();
24
        $adapterMock      = $this->getMockBuilder(Adapter::class)->disableOriginalConstructor()->getMock();
25
26
        $container = new Container();
27
        $container->bindInstance(CacheManager::class, $cacheManagerMock);
28
        $container->bindInstance(Adapter::class, $adapterMock);
29
30
        $this->sut->registerBindings($container);
31
32
        $actual = $container->resolve(CombinedAdapter::class);
33
        $this->assertInstanceOf(CombinedAdapter::class, $actual);
34
    }
35
}
36