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

FieldParserGraphicPrimitiveTest::getXmlField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 24
nc 1
nop 0
dl 0
loc 4
rs 9.536
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\FieldParserGraphicPrimitive;
7
use \SimpleXMLElement;
8
9
class FieldParserGraphicPrimitiveTest 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>GraphicPrimitive</FldType>
19
                <CLSID>{DC1F7EC4-7698-11D5-8036-005004D10645}</CLSID>
20
                <Displayed>1</Displayed>
21
                <X>4200</X>
22
                <Y>250</Y>
23
                <W>3775</W>
24
                <H>450</H>
25
                <Ln>1</Ln>
26
                <Data>
27
                    <Object>
28
                        <DataType>0</DataType>
29
                    </Object>
30
                </Data>
31
                <Graphic>
32
                    <GfxW>8500</GfxW>
33
                    <GfxH>4700</GfxH>
34
                    <Primitive>
35
                        <Shape>i am shape</Shape>
36
                        <LineW>25</LineW>
37
                    </Primitive>
38
                </Graphic>
39
            </Field>'
40
        );
41
    }
42
43
    /**
44
     * @return FieldParserGraphicPrimitive
45
     */
46
    protected function getParser()
47
    {
48
        if (!$this->parser) {
49
            $this->parser = new FieldParserGraphicPrimitive(
50
                $this->fieldParserRegistry,
51
                $this->xmlHeader,
52
                $this->getXmlField(),
53
                $this->scale
54
            );
55
        }
56
57
        return $this->parser;
58
    }
59
60
    public function testGetShape()
61
    {
62
        $shape = 'i am shape';
63
        $this->assertEquals($shape, $this->getParser()->getShape());
64
    }
65
66
    public function testGetLineWeight()
67
    {
68
        $lineWeight = 25;
69
        $this->assertEquals($lineWeight, $this->getParser()->getLineWeight());
70
    }
71
}
72