|
@@ 267-296 (lines=30) @@
|
| 264 |
|
); |
| 265 |
|
} |
| 266 |
|
|
| 267 |
|
public function testGetChildrenAsULMinNodeCount() { |
| 268 |
|
$obj1 = $this->objFromFixture('HierarchyTest_Object', 'obj1'); |
| 269 |
|
$obj2 = $this->objFromFixture('HierarchyTest_Object', 'obj2'); |
| 270 |
|
$obj2a = $this->objFromFixture('HierarchyTest_Object', 'obj2a'); |
| 271 |
|
|
| 272 |
|
// Set low enough that it should be fulfilled by root only elements |
| 273 |
|
$nodeCountThreshold = 3; |
| 274 |
|
|
| 275 |
|
$root = new HierarchyTest_Object(); |
| 276 |
|
$root->markPartialTree($nodeCountThreshold); |
| 277 |
|
$html = $root->getChildrenAsUL( |
| 278 |
|
"", |
| 279 |
|
'"<li id=\"" . $child->ID . "\">" . $child->Title', |
| 280 |
|
null, |
| 281 |
|
false, |
| 282 |
|
"AllChildrenIncludingDeleted", |
| 283 |
|
"numChildren", |
| 284 |
|
true, |
| 285 |
|
$nodeCountThreshold |
| 286 |
|
); |
| 287 |
|
$this->assertTreeContains($html, array($obj1), |
| 288 |
|
'Contains root elements' |
| 289 |
|
); |
| 290 |
|
$this->assertTreeContains($html, array($obj2), |
| 291 |
|
'Contains root elements' |
| 292 |
|
); |
| 293 |
|
$this->assertTreeNotContains($html, array($obj2, $obj2a), |
| 294 |
|
'Does not contains child elements because they exceed minNodeCount' |
| 295 |
|
); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
public function testGetChildrenAsULMinNodeCountWithMarkToExpose() { |
| 299 |
|
$obj2 = $this->objFromFixture('HierarchyTest_Object', 'obj2'); |
|
@@ 298-328 (lines=31) @@
|
| 295 |
|
); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
public function testGetChildrenAsULMinNodeCountWithMarkToExpose() { |
| 299 |
|
$obj2 = $this->objFromFixture('HierarchyTest_Object', 'obj2'); |
| 300 |
|
$obj2a = $this->objFromFixture('HierarchyTest_Object', 'obj2a'); |
| 301 |
|
$obj2aa = $this->objFromFixture('HierarchyTest_Object', 'obj2aa'); |
| 302 |
|
|
| 303 |
|
// Set low enough that it should be fulfilled by root only elements |
| 304 |
|
$nodeCountThreshold = 3; |
| 305 |
|
|
| 306 |
|
$root = new HierarchyTest_Object(); |
| 307 |
|
$root->markPartialTree($nodeCountThreshold); |
| 308 |
|
|
| 309 |
|
// Mark certain node which should be included regardless of minNodeCount restrictions |
| 310 |
|
$root->markToExpose($obj2aa); |
| 311 |
|
|
| 312 |
|
$html = $root->getChildrenAsUL( |
| 313 |
|
"", |
| 314 |
|
'"<li id=\"" . $child->ID . "\">" . $child->Title', |
| 315 |
|
null, |
| 316 |
|
false, |
| 317 |
|
"AllChildrenIncludingDeleted", |
| 318 |
|
"numChildren", |
| 319 |
|
true, |
| 320 |
|
$nodeCountThreshold |
| 321 |
|
); |
| 322 |
|
$this->assertTreeContains($html, array($obj2), |
| 323 |
|
'Contains root elements' |
| 324 |
|
); |
| 325 |
|
$this->assertTreeContains($html, array($obj2, $obj2a, $obj2aa), |
| 326 |
|
'Does contain marked children nodes regardless of configured threshold' |
| 327 |
|
); |
| 328 |
|
} |
| 329 |
|
|
| 330 |
|
public function testGetChildrenAsULMinNodeCountWithFilters() { |
| 331 |
|
$obj1 = $this->objFromFixture('HierarchyTest_Object', 'obj1'); |