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

OutlineBoxRendererTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 0
cbo 6
dl 0
loc 38
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testRender() 0 35 1
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