CasbinCombinedAdapterBootstrapperTest   A
last analyzed

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