| Conditions | 1 |
| Paths | 1 |
| Total Lines | 46 |
| Code Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function testRender() |
||
| 14 | { |
||
| 15 | $width = 2; |
||
| 16 | $height = 4; |
||
| 17 | $lineWeight = 1; |
||
| 18 | $parser = m::mock(FieldParserInterface::class) |
||
| 19 | ->shouldReceive('getWidth') |
||
| 20 | ->andReturn($width) |
||
| 21 | ->twice() |
||
| 22 | ->shouldReceive('getHeight') |
||
| 23 | ->andReturn($height) |
||
| 24 | ->twice() |
||
| 25 | ->shouldReceive('getLineWeight') |
||
| 26 | ->andReturn($lineWeight) |
||
| 27 | ->times(3) |
||
| 28 | ->getMock(); |
||
| 29 | |||
| 30 | $rectangle = m::mock('rectangle') |
||
| 31 | ->shouldReceive('border') |
||
| 32 | ->with($lineWeight, '#000') |
||
| 33 | ->once() |
||
| 34 | ->getMock(); |
||
| 35 | |||
| 36 | $closureExpection = function ($closureActual) use ($rectangle) { |
||
| 37 | $closureActual($rectangle); |
||
| 38 | return true; |
||
| 39 | }; |
||
| 40 | $image = m::mock(Image::class) |
||
| 41 | ->shouldReceive('rectangle') |
||
| 42 | ->with(0, 0, $width - $lineWeight, $height - $lineWeight, m::on($closureExpection)) |
||
| 43 | ->once() |
||
| 44 | ->getMock(); |
||
| 45 | |||
| 46 | $imageManager = m::mock(ImageManager::class) |
||
| 47 | ->shouldReceive('canvas') |
||
| 48 | ->with($width, $height) |
||
| 49 | ->andReturn($image) |
||
| 50 | ->getMock(); |
||
| 51 | |||
| 52 | $renderer = new FieldRendererOutlineBox(); |
||
| 53 | $imageActual = $renderer->render( |
||
| 54 | $imageManager, |
||
| 55 | $parser |
||
| 56 | ); |
||
| 57 | |||
| 58 | $this->assertSame($image, $imageActual); |
||
| 59 | } |
||
| 61 |