testFactoryProcessesWithoutErrors()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 24
rs 8.9713
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
3
namespace JhFlexiTimeTest\Service\Factory;
4
5
use JhFlexiTime\Service\Factory\CappedCreditServiceFactory;
6
use PHPUnit_Framework_TestCase;
7
8
/**
9
 * Class CappedCreditServiceFactoryTest
10
 * @package JhFlexiTimeTest\Service\Factory
11
 * @author Aydin Hassan <[email protected]>
12
 */
13
class CappedCreditServiceFactoryTest extends PHPUnit_Framework_TestCase
14
{
15
    public function testFactoryProcessesWithoutErrors()
16
    {
17
        $serviceLocator   = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
18
        $services         = [
19
            'JhFlexiTime\ObjectManager'
20
                => $this->getMock('Doctrine\Common\Persistence\ObjectManager'),
21
            'JhFlexiTime\Repository\CappedCreditRepository'
22
                => $this->getMock('JhFlexiTime\Repository\CappedCreditRepositoryInterface'),
23
        ];
24
25
        $serviceLocator
26
            ->expects($this->any())
27
            ->method('get')
28
            ->will(
29
                $this->returnCallback(
30
                    function ($serviceName) use ($services) {
31
                        return $services[$serviceName];
32
                    }
33
                )
34
            );
35
36
        $factory = new CappedCreditServiceFactory();
37
        $this->assertInstanceOf('JhFlexiTime\Service\CappedCreditService', $factory->createService($serviceLocator));
38
    }
39
}
40