Completed
Push — master ( 5033a3...4be7fb )
by Bartko
03:45
created

NodeInfoTest::testSetNeedUpdate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
namespace StefanoTreeTest\Unit\NestedSet;
3
4
use StefanoTree\NestedSet\NodeInfo;
5
6
class NodeInfoTest
7
    extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
8
{
9
    public function testNodeInfoWithScope()
10
    {
11
        $nodeInfo = new NodeInfo(11, 29, 33, 44, 62, 45);
12
13
        $this->assertEquals(11, $nodeInfo->getId());
14
        $this->assertEquals(29, $nodeInfo->getParentId());
15
        $this->assertEquals(33, $nodeInfo->getLevel());
16
        $this->assertEquals(44, $nodeInfo->getLeft());
17
        $this->assertEquals(62, $nodeInfo->getRight());
18
        $this->assertEquals(45, $nodeInfo->getScope());
19
    }
20
21
    public function testSetLevel()
22
    {
23
        $nodeInfo = new NodeInfo(0, 0, 0, 0, 0, 0);
24
25
        $nodeInfo->setLevel(123);
26
        $this->assertEquals(123, $nodeInfo->getLevel());
27
    }
28
29
    public function testSetLeftIndex()
30
    {
31
        $nodeInfo = new NodeInfo(0, 0, 0, 0, 0, 0);
32
33
        $nodeInfo->setLeft(456);
34
        $this->assertEquals(456, $nodeInfo->getLeft());
35
    }
36
37
    public function testSetRightIndex()
38
    {
39
        $nodeInfo = new NodeInfo(0, 0, 0, 0, 0, 0);
40
41
        $nodeInfo->setRight(789);
42
        $this->assertEquals(789, $nodeInfo->getRight());
43
    }
44
45
    public function testIsNotRoot()
46
    {
47
        $nodeInfo = new NodeInfo(11, 29, 33, 44, 62, null);
48
49
        $this->assertFalse($nodeInfo->isRoot());
50
    }
51
52
    public function testIsRoot()
53
    {
54
        $nodeInfo = new NodeInfo(125, 0, 0, 1, 156, null);
55
56
        $this->assertTrue($nodeInfo->isRoot());
57
    }
58
}
59