Passed
Push — refactor-01-decoupling ( 3120c6...479d2f )
by John
04:44
created

BarcodeRendererTest::testRender()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 38
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 38
rs 9.424
c 0
b 0
f 0
cc 1
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;
0 ignored issues
show
Bug introduced by
The type Graze\CiffRenderer\Field\Renderer\BarcodeRenderer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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 = 111111111111;
17
        $width = 104;
18
        $height = 102;
19
20
        $canvas = m::mock(Image::class)
21
            ->shouldReceive('text')
0 ignored issues
show
Unused Code introduced by
The call to Mockery\MockInterface::shouldReceive() has too many arguments starting with 'text'. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
            ->/** @scrutinizer ignore-call */ shouldReceive('text')

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
22
            ->with('r{{{{{|BBRBRR{|{111110|', 52, $height, m::type('callable'))
23
            ->shouldReceive('resize')
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not exist on Mockery\Expectation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
            ->/** @scrutinizer ignore-call */ shouldReceive('resize')

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...
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