testFactoryProcessesWithoutErrors()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 17
nc 1
nop 0
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