RoleRepositoryFactoryTest   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
lcom 1
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFactoryReturnsRepositoryFromObjectManager() 0 21 1
1
<?php
2
3
namespace JhUserTest\Repository\Factory;
4
5
use JhUser\Repository\Factory\RoleRepositoryFactory;
6
7
/**
8
 * Class RoleRepositoryFactoryTest
9
 * @package JhUserTest\Repository\Factory
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class RoleRepositoryFactoryTest 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('JhUser\Entity\HierarchicalRole'))
24
            ->will($this->returnValue($objectRepository));
25
        $serviceLocator
26
            ->expects($this->any())
27
            ->method('get')
28
            ->with('JhUser\ObjectManager')
29
            ->will($this->returnValue($objectManager));
30
31
        $factory = new RoleRepositoryFactory();
32
33
        $this->assertInstanceOf('JhUser\Repository\RoleRepository', $factory->createService($serviceLocator));
34
    }
35
}
36