Passed
Push — master ( efa86f...55c9f6 )
by Petr
10:18
created

ParentTest::testSimple()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
c 2
b 0
f 0
dl 0
loc 14
rs 9.8666
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BasicTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_templates\AHtmlElement;
8
9
10
/**
11
 * Class ParentTest
12
 * @package BasicTests
13
 * How to check traits? Extend them.
14
 */
15
class ParentTest extends CommonTestClass
16
{
17
    public function testSimple()
18
    {
19
        $data = new CurrentChild();
20
        $this->assertEmpty($data->getParent());
21
        $this->assertEmpty($data->count());
22
        $data->setParent(new ParentElement());
23
        $this->assertEquals(0, $data->getParent()->count());
24
        $this->assertInstanceOf('\kalanis\kw_templates\AHtmlElement', $data);
25
        $data->append(new AnotherChild());
26
        $this->assertEmpty($data->count());
27
        $this->assertNotEquals(0, $data->getParent()->count());
28
        $this->assertInstanceOf('\BasicTests\AnotherChild', $data->getParent()->lastChild());
29
        $data->setParent(null);
30
        $this->assertEmpty($data->getParent());
31
    }
32
}
33
34
35
class CurrentChild extends AHtmlElement
36
{
37
}
38
39
40
class AnotherChild extends AHtmlElement
41
{
42
}
43
44
45
class ParentElement extends AHtmlElement
46
{
47
}
48