RoleControllerFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testFactoryProcessesWithoutErrors() 0 27 1
1
<?php
2
3
namespace JhUserTest\Controller\Factory;
4
5
use JhUser\Controller\Factory\RoleControllerFactory;
6
use Zend\Mvc\Controller\PluginManager;
7
8
/**
9
 * Class RoleControllerFactoryTest
10
 * @package JhTimeTest\Controller\Factory
11
 * @author Aydin Hassan <[email protected]>
12
 */
13
class RoleControllerFactoryTest extends \PHPUnit_Framework_TestCase
14
{
15
    public function testFactoryProcessesWithoutErrors()
16
    {
17
18
        $services = [
19
            'JhUser\ObjectManager'                  => $this->getMock('Doctrine\Common\Persistence\ObjectManager'),
20
            'JhUser\Repository\UserRepository'      => $this->getMock('JhUser\Repository\UserRepositoryInterface'),
21
            'JhUser\Repository\RoleRepository'      => $this->getMock('JhUser\Repository\RoleRepositoryInterface'),
22
        ];
23
24
        $serviceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
25
        $serviceLocator
26
            ->expects($this->any())
27
            ->method('get')
28
            ->will(
29
                $this->returnCallback(
30
                    function ($serviceName) use ($services) {
31
                        return $services[$serviceName];
32
                    }
33
                )
34
            );
35
36
        $controllerPluginManager = new PluginManager();
37
        $controllerPluginManager->setServiceLocator($serviceLocator);
38
39
        $factory = new RoleControllerFactory();
40
        $this->assertInstanceOf('JhUser\Controller\RoleController', $factory->createService($controllerPluginManager));
41
    }
42
}
43