TimeCalculatorServiceFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 31
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testFactoryProcessesWithoutErrors() 0 28 1
1
<?php
2
3
namespace JhFlexiTimeTest\Service\Factory;
4
5
use JhFlexiTime\Service\Factory\TimeCalculatorServiceFactory;
6
7
/**
8
 * Class TimeCalculatorServiceFactoryTest
9
 * @package JhFlexiTimeTest\Service\Factory
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class TimeCalculatorServiceFactoryTest extends \PHPUnit_Framework_TestCase
13
{
14
    public function testFactoryProcessesWithoutErrors()
15
    {
16
        $serviceLocator   = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
17
        $services         = [
18
            'FlexiOptions' =>
19
                $this->getMock('JhFlexiTime\Options\ModuleOptions'),
20
            'JhFlexiTime\Repository\BookingRepository'  =>
21
                $this->getMock('JhFlexiTime\Repository\BookingRepositoryInterface'),
22
            'JhFlexiTime\Repository\BalanceRepository' =>
23
                $this->getMock('JhFlexiTime\Repository\BalanceRepositoryInterface'),
24
            'JhFlexiTime\Service\PeriodService' =>
25
                $this->getMock('JhFlexiTime\Service\PeriodServiceInterface'),
26
        ];
27
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
        $factory = new TimeCalculatorServiceFactory();
40
        $this->assertInstanceOf('JhFlexiTime\Service\TimeCalculatorService', $factory->createService($serviceLocator));
41
    }
42
}
43