RunningBalanceServiceFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testFactoryProcessesWithoutErrors() 0 32 1
1
<?php
2
3
namespace JhFlexiTimeTest\Service\Factory;
4
5
use JhFlexiTime\Service\Factory\RunningBalanceServiceFactory;
6
7
/**
8
 * Class RunningBalanceServiceFactoryTest
9
 * @package JhFlexiTimeTest\Service\Factory
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class RunningBalanceServiceFactoryTest extends \PHPUnit_Framework_TestCase
13
{
14
    public function testFactoryProcessesWithoutErrors()
15
    {
16
        $serviceLocator   = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
17
        $services         = [
18
            'JhUser\Repository\UserRepository' =>
19
                $this->getMock('JhUser\Repository\UserRepositoryInterface'),
20
            'JhFlexiTime\Repository\UserSettingsRepository' =>
21
                $this->getMock('JhFlexiTime\Repository\UserSettingsRepositoryInterface'),
22
            'JhFlexiTime\Repository\BookingRepository' =>
23
                $this->getMock('JhFlexiTime\Repository\BookingRepositoryInterface'),
24
            'JhFlexiTime\Repository\BalanceRepository' =>
25
                $this->getMock('JhFlexiTime\Repository\BalanceRepositoryInterface'),
26
            'JhFlexiTime\Service\PeriodService' =>
27
                $this->getMock('JhFlexiTime\Service\PeriodServiceInterface'),
28
            'JhFlexiTime\ObjectManager' =>
29
                $this->getMock('Doctrine\Common\Persistence\ObjectManager'),
30
        ];
31
32
        $serviceLocator
33
            ->expects($this->any())
34
            ->method('get')
35
            ->will(
36
                $this->returnCallback(
37
                    function ($serviceName) use ($services) {
38
                        return $services[$serviceName];
39
                    }
40
                )
41
            );
42
43
        $factory = new RunningBalanceServiceFactory();
44
        $this->assertInstanceOf('JhFlexiTime\Service\RunningBalanceService', $factory->createService($serviceLocator));
45
    }
46
}
47