Completed
Pull Request — master (#17)
by John
03:40
created

AbstractParserTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 8
c 3
b 1
f 0
lcom 1
cbo 4
dl 0
loc 57
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
A testGetParserManager() 0 8 1
A testGetFieldName() 0 4 1
A testGetPositionX() 0 4 1
A testGetPositionY() 0 4 1
A testGetWidth() 0 4 1
A testGetHeight() 0 4 1
A testGetIsDisplayed() 0 4 1
1
<?php
2
3
namespace Graze\CiffRenderer\Test;
4
5
use \Mockery as m;
6
use Graze\CiffRenderer\Field\Parser\AbstractParser;
7
use Graze\CiffRenderer\Field\Parser\ParserManager;
8
9
class AbstractParserTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @var \Graze\CiffRenderer\Field\Parser\ParserInterface
13
     */
14
    protected $parser;
15
16
    public function setUp()
17
    {
18
        $pathToFixture = sprintf('%s/Fixture/StaticGraphicParserFixture.xml', dirname(__FILE__));
19
20
        $xml = simplexml_load_file($pathToFixture);
21
22
        $this->parser = m::mock(AbstractParser::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...Parser\ParserInterface> of property $parser.

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...
23
24
        $this->parser->setXmlField($xml);
25
    }
26
27
    public function testGetParserManager()
28
    {
29
        $parserManager = m::mock(ParserManager::class);
30
31
        $this->parser->setParserManager($parserManager);
32
33
        $this->assertSame($parserManager, $this->parser->getParserManager());
34
    }
35
36
    public function testGetFieldName()
37
    {
38
        $this->assertEquals('staticGraphic1', $this->parser->getFieldName());
39
    }
40
41
    public function testGetPositionX()
42
    {
43
        $this->assertEquals(1008, $this->parser->getPositionX());
44
    }
45
46
    public function testGetPositionY()
47
    {
48
        $this->assertEquals(133, $this->parser->getPositionY());
49
    }
50
51
    public function testGetWidth()
52
    {
53
        $this->assertEquals(8367, $this->parser->getWidth());
54
    }
55
56
    public function testGetHeight()
57
    {
58
        $this->assertEquals(4625, $this->parser->getHeight());
59
    }
60
61
    public function testGetIsDisplayed()
62
    {
63
        $this->assertSame(true, $this->parser->getIsDisplayed());
64
    }
65
}
66