XmlTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testFromXml() 0 3 1
A testToXml() 0 4 1
A testFromXmlInvalidString() 0 3 1
1
<?php
2
3
namespace GuillermoandraeTest\Highrise\Helpers;
4
5
use Guillermoandrae\Highrise\Helpers\Xml;
6
use PHPUnit\Framework\TestCase;
7
8
class XmlTest extends TestCase
9
{
10
    public function testToXml()
11
    {
12
        $expectedXml = '<test><name>test</name></test>';
13
        $this->assertSame($expectedXml, Xml::toXml('test', ['name' => 'test']));
14
    }
15
16
    public function testFromXml()
17
    {
18
        $this->assertSame(['name' => 'test'], Xml::fromXml('<test><name>test</name></test>'));
19
    }
20
21
    public function testFromXmlInvalidString()
22
    {
23
        $this->assertEmpty(Xml::fromXml('<yo>'));
24
    }
25
}
26