UserReminderCliControllerFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
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 35
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testFactoryProcessesWithoutErrors() 0 32 1
1
<?php
2
3
namespace JhFlexiTimeTest\Controller\Factory;
4
5
use JhFlexiTime\Controller\Factory\UserReminderCliControllerFactory;
6
use PHPUnit_Framework_TestCase;
7
use Zend\Mvc\Controller\PluginManager;
8
9
/**
10
 * Class UserReminderCliControllerFactoryTest
11
 * @package JhFlexiTimeTest\Controller\Factory
12
 * @author Aydin Hassan <[email protected]>
13
 */
14
class UserReminderCliControllerFactoryTest extends PHPUnit_Framework_TestCase
15
{
16
    public function testFactoryProcessesWithoutErrors()
17
    {
18
19
        $service = $this->getMockBuilder('\JhFlexiTime\Service\MissingBookingReminderService')
20
            ->disableOriginalConstructor()
21
            ->getMock();
22
        $services = [
23
            'JhFlexiTime\Service\MissingBookingReminderService' => $service,
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 UserReminderCliControllerFactory();
43
        $this->assertInstanceOf(
44
            'JhFlexiTime\Controller\UserReminderCliController',
45
            $factory->createService($controllerPluginManager)
46
        );
47
    }
48
}
49