AdapterFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testWillInstantiateFromFQCN() 0 25 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModuleTest\Service\Authentication;
6
7
use DoctrineModule\Service\Authentication\AdapterFactory;
8
use Laminas\ServiceManager\ServiceManager;
9
use PHPUnit\Framework\TestCase as BaseTestCase;
10
11
class AdapterFactoryTest extends BaseTestCase
12
{
13
    public function testWillInstantiateFromFQCN() : void
14
    {
15
        $name           = 'testFactory';
16
        $factory        = new AdapterFactory($name);
17
        $objectManager  = $this->createMock('Doctrine\Persistence\ObjectManager');
18
        $serviceManager = new ServiceManager();
19
        $serviceManager->setService(
20
            'config',
21
            [
22
                'doctrine' => [
23
                    'authentication' => [
24
                        $name => [
25
                            'objectManager' => $objectManager,
26
                            'identityClass' => 'DoctrineModuleTest\Authentication\Adapter\TestAsset\IdentityObject',
27
                            'identityProperty' => 'username',
28
                            'credentialProperty' => 'password',
29
                        ],
30
                    ],
31
                ],
32
            ]
33
        );
34
35
        $adapter = $factory->createService($serviceManager);
36
        $this->assertInstanceOf('DoctrineModule\Authentication\Adapter\ObjectRepository', $adapter);
37
    }
38
}
39