MissingBookingReminderServiceFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 37
rs 10

1 Method

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