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

BarcodeRendererTest::testRender()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 39
rs 8.8571
cc 1
eloc 32
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\BarcodeRenderer;
7
use Intervention\Image\ImageManager;
8
use Intervention\Image\Image;
9
10
class BarcodeRendererTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function testRender()
13
    {
14
        $fontResolver = function () {
15
        };
16
        $text = 'this is some text';
17
        $width = 104;
18
        $height = 102;
19
20
        $canvas = m::mock(Image::class)
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not seem to exist on object<Mockery\Expectation>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
            ->shouldReceive('text')
22
            ->with($text, 52, $height, m::type('callable'))
23
            ->shouldReceive('resize')
24
            ->getMock();
25
26
        $imageManager = m::mock(ImageManager::class)
27
            ->shouldReceive('canvas')
28
            ->with($width, $height, '#000')
29
            ->andReturn($canvas)
30
            ->getMock();
31
32
        $renderer = m::mock(BarcodeRenderer::class)
33
            ->shouldAllowMockingProtectedMethods()
34
            ->shouldReceive('getWidth')
35
            ->andReturn($width)
36
            ->shouldReceive('getHeight')
37
            ->andReturn($height)
38
            ->shouldReceive('getImageManager')
39
            ->andReturn($imageManager)
40
            ->shouldReceive('getFontResolver')
41
            ->andReturn($fontResolver)
42
            ->shouldReceive('getFontFace')
43
            ->shouldReceive('getFontSize')
44
            ->shouldReceive('getText')
45
            ->andReturn($text)
46
            ->getMock()
47
            ->makePartial();
48
49
        $this->assertSame($canvas, $renderer->render());
50
    }
51
}
52