Conditions | 1 |
Paths | 1 |
Total Lines | 31 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function testRender() |
||
14 | { |
||
15 | $imageRaw = 'fake image'; |
||
16 | $imageExptected = m::mock(Image::class); |
||
17 | $imageManager = m::mock(ImageManager::class) |
||
18 | ->shouldReceive('make') |
||
19 | ->with($imageRaw) |
||
20 | ->andReturn($imageExptected) |
||
21 | ->once() |
||
22 | ->getMock(); |
||
23 | $pathExpected = '/path/to/graphic'; |
||
24 | $parser = m::mock(FieldParserInterface::class) |
||
25 | ->shouldReceive('getGraphic') |
||
26 | ->andReturn($pathExpected) |
||
27 | ->once() |
||
28 | ->getMock(); |
||
29 | $graphicResolver = function ($path) use ($pathExpected, $imageRaw) { |
||
30 | $this->assertEquals($pathExpected, $path); |
||
31 | return $imageRaw; |
||
32 | }; |
||
33 | |||
34 | $renderer = new FieldRendererStaticGraphic(); |
||
35 | $image = $renderer->render( |
||
36 | $imageManager, |
||
37 | $parser, |
||
38 | null, |
||
39 | $graphicResolver |
||
40 | ); |
||
41 | |||
42 | $this->assertEquals($imageExptected, $image); |
||
43 | } |
||
44 | } |
||
45 |