Conditions | 1 |
Paths | 1 |
Total Lines | 38 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function testInvokeWillCreateACommentInstance() |
||
16 | { |
||
17 | $containerMock = $this->createMock(ContainerInterface::class); |
||
18 | |||
19 | $viewHelperManagerMock = |
||
20 | $this->getMockBuilder('ViewHelperManager') |
||
21 | ->setMethods(['get']) |
||
22 | ->getMock(); |
||
23 | |||
24 | $routerMock = $this->getMockBuilder('Router')->getMock(); |
||
25 | |||
26 | $configMock = [uniqid()]; |
||
27 | |||
28 | $commentTableMock = $this->createMock(CommentTable::class); |
||
29 | |||
30 | $factory = new CommentFactory(); |
||
31 | |||
32 | // Expectations |
||
33 | $containerMock->expects($this->exactly(4)) |
||
34 | ->method('get') |
||
35 | ->withConsecutive( |
||
36 | ['ViewHelperManager'], |
||
37 | ['Router'], |
||
38 | ['Config'], |
||
39 | [CommentTable::class] |
||
40 | ) |
||
41 | ->willReturnOnConsecutiveCalls( |
||
42 | $viewHelperManagerMock, |
||
43 | $routerMock, |
||
44 | $configMock, |
||
45 | $commentTableMock |
||
46 | ); |
||
47 | |||
48 | $table = $factory($containerMock, Comment::class); |
||
49 | |||
50 | // Assertions |
||
51 | $this->assertInstanceOf(Comment::class, $table); |
||
52 | } |
||
53 | } |
||
54 |