@@ 124-144 (lines=21) @@ | ||
121 | $this->assertEquals($params, $this->object->getRouteParams()); |
|
122 | } |
|
123 | ||
124 | public function testGetChildren() |
|
125 | { |
|
126 | $child1 = new MenuItem($this->object->getMenu()); |
|
127 | $child1->setAppearInNavigation(true); |
|
128 | $child2 = new MenuItem($this->object->getMenu()); |
|
129 | $child2->setAppearInNavigation(true); |
|
130 | $children = [$child1, $child2]; |
|
131 | ||
132 | $menuBuilder = $this->getMockBuilder('Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder') |
|
133 | ->disableOriginalConstructor() |
|
134 | ->getMock(); |
|
135 | $menuBuilder->expects($this->once()) |
|
136 | ->method('getChildren') |
|
137 | ->will($this->returnValue($children)); |
|
138 | ||
139 | /* @var $menuBuilder MenuBuilder */ |
|
140 | $parent = new MenuItem($menuBuilder); |
|
141 | $result = $parent->getChildren(); |
|
142 | $this->assertEquals(2, \count($result)); |
|
143 | $this->assertEquals($children, $result); |
|
144 | } |
|
145 | ||
146 | public function testGetNavigationChildren() |
|
147 | { |
|
@@ 146-166 (lines=21) @@ | ||
143 | $this->assertEquals($children, $result); |
|
144 | } |
|
145 | ||
146 | public function testGetNavigationChildren() |
|
147 | { |
|
148 | $child1 = new MenuItem($this->object->getMenu()); |
|
149 | $child1->setAppearInNavigation(true); |
|
150 | $child2 = new MenuItem($this->object->getMenu()); |
|
151 | $child2->setAppearInNavigation(false); |
|
152 | $children = [$child1, $child2]; |
|
153 | ||
154 | $menuBuilder = $this->getMockBuilder('Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder') |
|
155 | ->disableOriginalConstructor() |
|
156 | ->getMock(); |
|
157 | $menuBuilder->expects($this->once()) |
|
158 | ->method('getChildren') |
|
159 | ->will($this->returnValue($children)); |
|
160 | ||
161 | /* @var $menuBuilder MenuBuilder */ |
|
162 | $parent = new MenuItem($menuBuilder); |
|
163 | $result = $parent->getNavigationChildren(); |
|
164 | $this->assertEquals(1, \count($result)); |
|
165 | $this->assertEquals([$child1], $result); |
|
166 | } |
|
167 | ||
168 | public function testGetTopChildren() |
|
169 | { |