Completed
Branch master (0d9475)
by WEBEWEB
02:41 queued 01:18
created

NavigationNodeTest::testConstructor()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 26
rs 8.8571
c 2
b 0
f 0
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\Node\NavigationNode;
16
17
/**
18
 * Navigation node test.
19
 *
20
 * @author NdC/WBW <https://github.com/webeweb/>
21
 * @package WBW\Library\Core\Tests\Navigation\Node
22
 * @final
23
 */
24
final class NavigationNodeTest extends PHPUnit_Framework_TestCase {
25
26
	/**
27
	 * Tests the __construct() method.
28
	 *
29
	 * @return void
30
	 */
31
	public function testConstructor() {
32
33
		$obj = new NavigationNode("id");
34
35
		$this->assertEquals(false, $obj->getActive());
36
		$this->assertEquals(false, $obj->getEnable());
37
		$this->assertEquals(null, $obj->getIcon());
38
		$this->assertEquals(null, $obj->getRoute());
39
		$this->assertEquals(null, $obj->getTarget());
40
		$this->assertEquals(null, $obj->getUrl());
41
		$this->assertEquals(true, $obj->getVisible());
42
43
		$obj->setActive(true);
44
		$obj->setEnable(true);
45
		$obj->setIcon("icon");
46
		$obj->setRoute("route");
47
		$obj->setTarget("_blank");
48
		$obj->setUrl("url");
49
50
		$this->assertEquals(true, $obj->getActive());
51
		$this->assertEquals(true, $obj->getEnable());
52
		$this->assertEquals("icon", $obj->getIcon());
53
		$this->assertEquals("route", $obj->getRoute());
54
		$this->assertEquals("_blank", $obj->getTarget());
55
		$this->assertEquals("url", $obj->getUrl());
56
	}
57
58
	/**
59
	 * Tests the isDisplayable() method.
60
	 *
61
	 * @return void
62
	 */
63
	public function testIsDisplayable() {
64
65
		$obj = new NavigationNode("id");
66
67
		$obj->addNode(new NavigationNode("id2"));
68
69
		$this->assertEquals(false, $obj->isDisplayable());
70
71
		$obj->getLastNode()->setActive(true);
72
		$obj->getLastNode()->setEnable(true);
73
		$this->assertEquals(true, $obj->isDisplayable());
74
	}
75
76
}
77