Passed
Push — master ( 4870c3...732c37 )
by Petr
07:47
created

SourcesTest::testBasic()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace BasicTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_address_handler\Sources;
8
9
10
class SourcesTest extends CommonTestClass
11
{
12
    public function testBasic(): void
13
    {
14
        $source = new Sources\Sources();
15
        $source->setAddress('//abc/def//ghi/jkl');
16
        $this->assertEquals('/abc/def//ghi/jkl', (string) $source);
17
        $source->setPath('//abc/def//ghi/jkl');
18
        $this->assertEquals('//abc/def//ghi/jkl', $source->getPath());
19
    }
20
21
    public function testAddress()
22
    {
23
        $source = new Sources\Address('//abc/def//ghi/jkl');
24
        $this->assertEquals('/abc/def//ghi/jkl', (string) $source);
25
    }
26
27
    public function testArrayAccess()
28
    {
29
        $array = new \ArrayObject();
30
        $source1 = new Sources\InputArray($array, 'tester');
31
        $this->assertEmpty('', (string) $source1);
32
33
        $array->offsetSet('tester', '//abc/def//ghi/jkl');
34
        $source2 = new Sources\InputArray($array, 'tester');
35
        $this->assertEquals('/abc/def//ghi/jkl', (string) $source2);
36
    }
37
}
38