Completed
Push — master ( db33ac...af29ce )
by WEBEWEB
02:54 queued 11s
created

NavigationNodeTest::testConstructor()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 26
rs 8.8571
cc 1
eloc 21
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2017 NdC/WBW
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\Tests\Navigation\Node;
13
14
use PHPUnit_Framework_TestCase;
15
use WBW\Library\Core\Navigation\Item\NavigationItem;
16
use WBW\Library\Core\Navigation\Node\NavigationNode;
17
18
/**
19
 * Navigation node test.
20
 *
21
 * @author NdC/WBW <https://github.com/webeweb/>
22
 * @package WBW\Library\Core\Tests\Navigation\Node
23
 * @final
24
 */
25
final class NavigationNodeTest extends PHPUnit_Framework_TestCase {
26
27
	/**
28
	 * Tests the __construct() method.
29
	 *
30
	 * @return void
31
	 */
32
	public function testConstructor() {
33
34
		$obj = new NavigationNode("id");
35
36
		$this->assertEquals(false, $obj->getActive());
37
		$this->assertEquals(false, $obj->getEnable());
38
		$this->assertEquals(null, $obj->getIcon());
39
		$this->assertEquals(null, $obj->getRoute());
40
		$this->assertEquals(null, $obj->getTarget());
41
		$this->assertEquals(null, $obj->getUrl());
42
		$this->assertEquals(true, $obj->getVisible());
43
44
		$obj->setActive(true);
45
		$obj->setEnable(true);
46
		$obj->setIcon("icon");
47
		$obj->setRoute("route");
48
		$obj->setTarget("_blank");
49
		$obj->setUrl("url");
50
51
		$this->assertEquals(true, $obj->getActive());
52
		$this->assertEquals(true, $obj->getEnable());
53
		$this->assertEquals("icon", $obj->getIcon());
54
		$this->assertEquals("route", $obj->getRoute());
55
		$this->assertEquals("_blank", $obj->getTarget());
56
		$this->assertEquals("url", $obj->getUrl());
57
	}
58
59
	/**
60
	 * Tests the isDisplayable() method.
61
	 *
62
	 * @return void
63
	 */
64
	public function testIsDisplayable() {
65
66
		$obj = new NavigationNode("id");
67
68
		$obj->addNode(new NavigationItem("id1"));
69
		$obj->addNode(new NavigationNode("id2"));
70
71
		$this->assertEquals(false, $obj->isDisplayable());
72
73
		$obj->getLastNode()->setActive(true);
74
		$obj->getLastNode()->setEnable(true);
75
		$this->assertEquals(true, $obj->isDisplayable());
76
	}
77
78
}
79