CappedCreditServiceFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testFactoryProcessesWithoutErrors() 0 24 1
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