Completed
Push — master ( f2fd19...c76b04 )
by Brendan
02:16
created

XmlFormatterTest::testFormat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 0
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Graze\XmlUtils\Tests\Unit;
4
5
use Graze\XmlUtils\XmlFormatter;
6
use PHPUnit\Framework\TestCase;
7
8
class XmlFormatterTest extends TestCase
9
{
10
    public function testFormat()
11
    {
12
        $unformattedXml = '<?xml version="1.0" encoding="UTF-8"?><root><child1>123</child1><child2 attribute="1"><subchild1>456</subchild1></child2></root>';
13
        
14
        $expectedFormattedXml = <<<EOF
15
<?xml version="1.0" encoding="UTF-8"?>
16
<root>
17
  <child1>123</child1>
18
  <child2 attribute="1">
19
    <subchild1>456</subchild1>
20
  </child2>
21
</root>
22
23
EOF;
24
25
        $xmlFormatter = new XmlFormatter();
26
        $formattedXml = $xmlFormatter->format($unformattedXml);
27
28
        $this->assertEquals($expectedFormattedXml, $formattedXml);
29
    }
30
}
31