Completed
Pull Request — master (#15)
by John
02:41
created

OutlineBoxRendererTest::testRender()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 35
rs 8.8571
cc 1
eloc 29
nc 1
nop 0
1
<?php
2
3
namespace Graze\CiffRenderer\Test\Field\Renderer;
4
5
use \Mockery as m;
6
use Graze\CiffRenderer\Field\Renderer\GraphicPrimitive\OutlineBoxRenderer;
7
use Intervention\Image\ImageManager;
8
use Intervention\Image\Image;
9
10
class OutlineBoxRendererTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function testRender()
13
    {
14
        $width = 20;
15
        $height = 22;
16
        $lineWeight = 10;
17
        $tracerColour = '#ccc';
18
19
        $canvas = m::mock(Image::class)
20
            ->shouldReceive('rectangle')
21
            ->with(0, 0, 10, 12, m::type('callable'))
22
            ->getMock();
23
24
        $imageManager = m::mock(ImageManager::class)
25
            ->shouldReceive('canvas')
26
            ->with($width, $height, $tracerColour)
27
            ->andReturn($canvas)
28
            ->getMock();
29
30
        $renderer = m::mock(OutlineBoxRenderer::class)
31
            ->shouldAllowMockingProtectedMethods()
32
            ->shouldReceive('getWidth')
33
            ->andReturn($width)
34
            ->shouldReceive('getHeight')
35
            ->andReturn($height)
36
            ->shouldReceive('getTracerColour')
37
            ->andReturn($tracerColour)
38
            ->shouldReceive('getLineWeight')
39
            ->andReturn($lineWeight)
40
            ->shouldReceive('getImageManager')
41
            ->andReturn($imageManager)
42
            ->getMock()
43
            ->makePartial();
44
45
        $this->assertEquals($canvas, $renderer->render());
46
    }
47
}
48