Completed
Branch master (4d68bf)
by John
02:46
created

FieldParserStaticGraphicTest::getXmlField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 25
nc 1
nop 0
dl 0
loc 4
rs 9.52
c 0
b 0
f 0
1
<?php
2
3
namespace Graze\CiffRenderer\Test\Parser\FieldParser;
4
5
use Graze\CiffRenderer\Test\AbstractFieldParserTest;
6
use Graze\CiffRenderer\Parser\FieldParser\FieldParserStaticGraphic;
7
use \SimpleXMLElement;
8
9
class FieldParserStaticGraphicTest extends AbstractFieldParserTest
10
{
11
    /**
12
     * @return SimpleXMLElement
13
     */
14
    private function getXmlField()
15
    {
16
        return new SimpleXMLElement(
17
            '<Field Name="i am field name">
18
                <FldType>StaticGraphic</FldType>
19
                <CLSID>{6AE09851-D80F-11D4-8DAE-0050DAFE8A9F}</CLSID>
20
                <X>4200</X>
21
                <Y>250</Y>
22
                <W>3775</W>
23
                <H>450</H>
24
                <Ln>1</Ln>
25
                <CalcData><![CDATA[i am path to graphic]]></CalcData>
26
                <Data>
27
                    <Object>
28
                        <DataType>0</DataType>
29
                        <MaxNoOfChars>14</MaxNoOfChars>
30
                        <Default><![CDATA[i am path to graphic]]></Default>
31
                    </Object>
32
                </Data>
33
                <Graphic>
34
                    <GfxW>8500</GfxW>
35
                    <GfxH>4700</GfxH>
36
                    <StaticGfx>
37
                        <AspectRatio>0</AspectRatio>
38
                    </StaticGfx>
39
                </Graphic>
40
            </Field>'
41
        );
42
    }
43
44
    /**
45
     * @return FieldParserStaticGraphic
46
     */
47
    protected function getParser()
48
    {
49
        if (!$this->parser) {
50
            $this->parser = new FieldParserStaticGraphic(
51
                $this->fieldParserRegistry,
52
                $this->xmlHeader,
53
                $this->getXmlField(),
54
                $this->scale
55
            );
56
        }
57
58
        return $this->parser;
59
    }
60
61
    public function testGetGraphic()
62
    {
63
        $graphic = 'i am path to graphic';
64
        $this->assertEquals($graphic, $this->getParser()->getGraphic());
65
    }
66
}
67