XmlTest::testToXml()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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