Example #1
0
 /**
  * This test checks that deleted ('archived') child pages _do_ set a css class on the parent
  * node that makes it look like it has children when getting all children including deleted
  */
 public function testGetChildrenAsULNodeDeletedOnStage()
 {
     $obj2 = $this->objFromFixture('HierarchyTest_Object', 'obj2');
     $obj2a = $this->objFromFixture('HierarchyTest_Object', 'obj2a');
     $obj2aa = $this->objFromFixture('HierarchyTest_Object', 'obj2aa');
     $obj2ab = $this->objFromFixture('HierarchyTest_Object', 'obj2b');
     // delete all children under obj2
     $obj2a->delete();
     $obj2aa->delete();
     $obj2ab->delete();
     // Don't pre-load all children
     $nodeCountThreshold = 1;
     $childrenMethod = 'AllChildrenIncludingDeleted';
     $numChildrenMethod = 'numHistoricalChildren';
     $root = new HierarchyTest_Object();
     $root->markPartialTree($nodeCountThreshold, null, $childrenMethod, $numChildrenMethod);
     // As in LeftAndMain::getSiteTreeFor() but simpler and more to the point for testing purposes
     $titleFn = function (&$child, $numChildrenMethod = "") {
         return '<li class="' . $child->markingClasses($numChildrenMethod) . '" id="' . $child->ID . '">"' . $child->Title;
     };
     $html = $root->getChildrenAsUL("", $titleFn, null, true, $childrenMethod, $numChildrenMethod, true, $nodeCountThreshold);
     // Get the class attribute from the $obj2 node in the sitetree
     $nodeClass = $this->getNodeClassFromTree($html, $obj2);
     // Object2 can now be expanded
     $this->assertEquals('unexpanded jstree-closed closed', $nodeClass, 'obj2 should have children in the sitetree');
 }