Completed
Push — master ( a25652...bbd63b )
by Alexander
02:34
created

XmlParserServiceTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetters() 0 13 1
A testIncorrectDocument() 0 6 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: horat1us
5
 * Date: 5/11/17
6
 * Time: 6:10 PM
7
 */
8
9
namespace Horat1us\Tests;
10
11
12
use Horat1us\Services\XmlParserService;
13
14
class XmlParserServiceTest extends \PHPUnit_Framework_TestCase
15
{
16
    public function testGetters()
17
    {
18
        $xml = '<?xml version="1.0"?>
19
<Person name="Alexander" surname="Letnikow"><Head size="big" mind="small"/></Person>
20
';
21
22
        $document = new \DOMDocument();
23
        $document->loadXML($xml);
24
25
        $service = new XmlParserService($document);
26
        $this->assertEquals($document, $service->getDocument());
27
        $this->assertEquals([], $service->getAliases());
28
    }
29
30
    public function testIncorrectDocument()
31
    {
32
        $document = new static;
33
        $this->expectException(\InvalidArgumentException::class);
34
        new XmlParserService($document);
35
    }
36
}