testFactoryProcessesWithoutErrors()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 34
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 34
rs 8.8571
cc 1
eloc 24
nc 1
nop 0
1
<?php
2
3
namespace JhFlexiTimeTest\Service\Factory;
4
5
use JhFlexiTime\Options\NotificationOptions;
6
use JhFlexiTime\Service\Factory\MissingBookingReminderServiceFactory;
7
use PHPUnit_Framework_TestCase;
8
9
/**
10
 * Class MissingBookingReminderServiceFactoryTest
11
 * @package JhFlexiTimeTest\Service\Factory
12
 * @author Aydin Hassan <[email protected]>
13
 */
14
class MissingBookingReminderServiceFactoryTest extends PHPUnit_Framework_TestCase
15
{
16
    public function testFactoryProcessesWithoutErrors()
17
    {
18
        $serviceLocator   = $this->getMock('Zend\ServiceManager\ServiceLocatorInterface');
19
        $services         = [
20
            'JhHubBase\Notification\NotificationService'
21
                => $this->getMock('JhHubBase\Notification\NotificationService'),
22
            'JhUser\Repository\UserRepository'
23
                => $this->getMock('JhUser\Repository\UserRepositoryInterface'),
24
            'JhFlexiTime\Repository\UserSettingsRepository'
25
                => $this->getMock('JhFlexiTime\Repository\UserSettingsRepositoryInterface'),
26
            'JhFlexiTime\Repository\BookingRepository'
27
                => $this->getMock('JhFlexiTime\Repository\BookingRepositoryInterface'),
28
            'JhFlexiTime\Options\NotificationOptions'
29
                => new NotificationOptions
30
31
        ];
32
33
        $serviceLocator
34
            ->expects($this->any())
35
            ->method('get')
36
            ->will(
37
                $this->returnCallback(
38
                    function ($serviceName) use ($services) {
39
                        return $services[$serviceName];
40
                    }
41
                )
42
            );
43
44
        $factory = new MissingBookingReminderServiceFactory();
45
        $this->assertInstanceOf(
46
            'JhFlexiTime\Service\MissingBookingReminderService',
47
            $factory->createService($serviceLocator)
48
        );
49
    }
50
}
51