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
|
|
|
protected $parser; |
12
|
|
|
|
13
|
|
|
public function setUp() |
14
|
|
|
{ |
15
|
|
|
$pathToFixture = sprintf('%s/Fixture/StaticGraphicParserFixture.xml', dirname(__FILE__)); |
16
|
|
|
|
17
|
|
|
$xml = simplexml_load_file($pathToFixture); |
18
|
|
|
|
19
|
|
|
$this->parser = m::mock(AbstractParser::class)->makePartial(); |
20
|
|
|
|
21
|
|
|
$this->parser->setXmlField($xml); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function testGetParserManager() |
25
|
|
|
{ |
26
|
|
|
$parserManager = m::mock(ParserManager::class); |
27
|
|
|
|
28
|
|
|
$this->parser->setParserManager($parserManager); |
29
|
|
|
|
30
|
|
|
$this->assertSame($parserManager, $this->parser->getParserManager()); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testGetFieldName() |
34
|
|
|
{ |
35
|
|
|
$this->assertEquals('staticGraphic1', $this->parser->getFieldName()); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function testGetPositionX() |
39
|
|
|
{ |
40
|
|
|
$this->assertEquals(1008, $this->parser->getPositionX()); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testGetPositionY() |
44
|
|
|
{ |
45
|
|
|
$this->assertEquals(133, $this->parser->getPositionY()); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function testGetWidth() |
49
|
|
|
{ |
50
|
|
|
$this->assertEquals(8367, $this->parser->getWidth()); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function testGetHeight() |
54
|
|
|
{ |
55
|
|
|
$this->assertEquals(4625, $this->parser->getHeight()); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function testGetIsDisplayed() |
59
|
|
|
{ |
60
|
|
|
$this->assertSame(true, $this->parser->getIsDisplayed()); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|