testFactoryProcessesWithoutErrors()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 28
rs 8.8571
cc 1
eloc 20
nc 1
nop 0
1
<?php
2
3
namespace JhFlexiTimeTest\Install\Factory;
4
5
use JhFlexiTime\Install\Factory\InstallerFactory;
6
7
/**
8
 * Class InstallerFactoryTest
9
 * @package JhFlexiTimeTest\Install\Factory
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class InstallerFactoryTest 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\BalanceRepository' =>
23
                $this->getMock('JhFlexiTime\Repository\BalanceRepositoryInterface'),
24
            'JhFlexiTime\ObjectManager' =>
25
                $this->getMock('Doctrine\Common\Persistence\ObjectManager'),
26
        ];
27
28
        $serviceLocator
29
            ->expects($this->any())
30
            ->method('get')
31
            ->will(
32
                $this->returnCallback(
33
                    function ($serviceName) use ($services) {
34
                        return $services[$serviceName];
35
                    }
36
                )
37
            );
38
39
        $factory = new InstallerFactory();
40
        $this->assertInstanceOf('JhFlexiTime\Install\Installer', $factory->createService($serviceLocator));
41
    }
42
}
43