testFactoryProcessesWithoutErrors()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

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