Conditions | 1 |
Paths | 1 |
Total Lines | 36 |
Code Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function testCreateDelegatorWithName() |
||
11 | { |
||
12 | $eventManager = $this->getMockBuilder('Zend\\EventManager\\EventManagerInterface')->getMock(); |
||
13 | $client = $this->getMockBuilder('PamiModule\\Service\\Client') |
||
14 | ->disableOriginalConstructor() |
||
15 | ->setMethods(['getEventManager']) |
||
16 | ->getMock(); |
||
17 | $serviceLocator = $this->getMockBuilder('Zend\\ServiceManager\\ServiceManager')->getMock(); |
||
18 | |||
19 | $client->expects(static::any()) |
||
20 | ->method('getEventManager') |
||
21 | ->willReturn($eventManager); |
||
22 | |||
23 | $listener = $this->getMockBuilder(ConnectionStatusListener::class) |
||
24 | ->disableOriginalConstructor() |
||
25 | ->setMethods(['attach']) |
||
26 | ->getMock(); |
||
27 | |||
28 | $serviceLocator->expects(static::once()) |
||
29 | ->method('get') |
||
30 | ->with(ConnectionStatusListener::class) |
||
31 | ->willReturn($listener); |
||
32 | |||
33 | $listener->expects(static::once()) |
||
34 | ->method('attach') |
||
35 | ->with($eventManager); |
||
36 | |||
37 | $callback = function () use ($client) { |
||
38 | return $client; |
||
39 | }; |
||
40 | |||
41 | $delegatorFactory = new ConnectionStatusDelegatorFactory(); |
||
42 | $result = $delegatorFactory->createDelegatorWithName($serviceLocator, '', '', $callback); |
||
43 | |||
44 | static::assertSame($client, $result); |
||
45 | } |
||
46 | } |
||
47 |