BalanceRepositoryFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFactoryReturnsRepositoryFromObjectManager() 0 21 1
1
<?php
2
3
namespace JhFlexiTimeTest\Repository\Factory;
4
5
use JhFlexiTime\Repository\Factory\BalanceRepositoryFactory;
6
7
/**
8
 * Class BalanceRepositoryFactoryTest
9
 * @package JhFlexiTimeTest\Repository\Factory
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class BalanceRepositoryFactoryTest extends \PHPUnit_Framework_TestCase
13
{
14
    public function testFactoryReturnsRepositoryFromObjectManager()
15
    {
16
        $objectManager    = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
17
        $objectRepository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
18
        $serviceLocator   = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
19
20
        $objectManager
21
            ->expects($this->any())
22
            ->method('getRepository')
23
            ->with($this->equalTo('JhFlexiTime\Entity\RunningBalance'))
24
            ->will($this->returnValue($objectRepository));
25
        $serviceLocator
26
            ->expects($this->any())
27
            ->method('get')
28
            ->with('JhFlexiTime\ObjectManager')
29
            ->will($this->returnValue($objectManager));
30
31
        $factory = new BalanceRepositoryFactory();
32
33
        $this->assertInstanceOf('JhFlexiTime\Repository\BalanceRepository', $factory->createService($serviceLocator));
34
    }
35
}
36