XmlFormatterTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFormat() 0 19 1
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 PHPUnit_Framework_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