RunningBalanceCliControllerFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 4
dl 0
loc 36
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testFactoryProcessesWithoutErrors() 0 33 1
1
<?php
2
3
namespace JhFlexiTimeTest\Controller\Factory;
4
5
use JhFlexiTime\Controller\Factory\RunningBalanceCliControllerFactory;
6
use Zend\Mvc\Controller\PluginManager;
7
8
/**
9
 * Class RunningBalanceCliControllerFactoryTest
10
 * @package JhFlexiTimeTest\Controller\Factory
11
 * @author Aydin Hassan <[email protected]>
12
 */
13
class RunningBalanceCliControllerFactoryTest extends \PHPUnit_Framework_TestCase
14
{
15
    public function testFactoryProcessesWithoutErrors()
16
    {
17
        $mockRunningBalanceService = $this->getMockBuilder('JhFlexiTime\Service\RunningBalanceService')
18
            ->disableOriginalConstructor()
19
            ->getMock();
20
21
        $services = [
22
            'JhUser\Repository\UserRepository'          => $this->getMock('JhUser\Repository\UserRepositoryInterface'),
23
            'JhFlexiTime\Service\RunningBalanceService' => $mockRunningBalanceService,
24
            'Console'                                   => $this->getMock('Zend\Console\Adapter\AdapterInterface')
25
        ];
26
27
        $serviceLocator = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
28
        $serviceLocator
29
            ->expects($this->any())
30
            ->method('get')
31
            ->will(
32
                $this->returnCallback(
33
                    function ($serviceName) use ($services) {
34
                        return $services[$serviceName];
35
                    }
36
                )
37
            );
38
39
        $controllerPluginManager = new PluginManager();
40
        $controllerPluginManager->setServiceLocator($serviceLocator);
41
42
        $factory = new RunningBalanceCliControllerFactory();
43
        $this->assertInstanceOf(
44
            'JhFlexiTime\Controller\RunningBalanceCliController',
45
            $factory->createService($controllerPluginManager)
46
        );
47
    }
48
}
49