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

AbstractRendererTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 5
c 3
b 1
f 0
lcom 1
cbo 5
dl 0
loc 48
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 20 1
A testGetPositionX() 0 4 1
A testGetPositionY() 0 4 1
A testGetWidth() 0 4 1
A testGetHeight() 0 4 1
1
<?php
2
3
namespace Graze\CiffRenderer\Test\Field\Renderer;
4
5
use \Mockery as m;
6
use Graze\CiffRenderer\Field\Renderer\AbstractRenderer;
7
use Graze\CiffRenderer\Field\Parser\ParserInterface;
8
9
class AbstractRendererTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @var \Graze\CiffRenderer\Field\Renderer\RendererInterface
13
     */
14
    protected $renderer;
15
16
    public function setUp()
17
    {
18
        $this->renderer = m::mock(AbstractRenderer::class)->makePartial();
0 ignored issues
show
Documentation Bug introduced by
It seems like \Mockery::mock(\Graze\Ci...::class)->makePartial() of type object<Mockery\Mock> is incompatible with the declared type object<Graze\CiffRendere...erer\RendererInterface> of property $renderer.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
19
20
        $parser = m::mock(ParserInterface::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('getPositionX')
22
            ->andReturn(2)
23
            ->shouldReceive('getPositionY')
24
            ->andReturn(3)
25
            ->shouldReceive('getWidth')
26
            ->andReturn(4)
27
            ->shouldReceive('getHeight')
28
            ->andReturn(5)
29
            ->getMock()
30
            ->makePartial();
31
32
        $this->renderer->setParser($parser);
33
34
        $this->renderer->setScale(10.2);
35
    }
36
37
    public function testGetPositionX()
38
    {
39
        $this->assertEquals(20.4, $this->renderer->getPositionX());
40
    }
41
42
    public function testGetPositionY()
43
    {
44
        $this->assertEquals(30.6, $this->renderer->getPositionY());
45
    }
46
47
    public function testGetWidth()
48
    {
49
        $this->assertEquals(40.8, $this->renderer->getWidth());
50
    }
51
52
    public function testGetHeight()
53
    {
54
        $this->assertEquals(51, $this->renderer->getHeight());
55
    }
56
}
57