/**
  * @test
  */
 public function getChildrenOfLevelMaximumSetToTwoWorks()
 {
     $expectedStorage = new TreeNodeCollection();
     $expectedFirstLevelTreeNode = new TreeNode();
     $expectedFirstLevelTreeNode->setId(1);
     $expectedSecondLevelTreeNode = new TreeNode();
     $expectedSecondLevelTreeNode->setId(2);
     $expectedStorageOfSecondLevelChildren = new TreeNodeCollection();
     $expectedStorageOfSecondLevelChildren->append($expectedSecondLevelTreeNode);
     $expectedFirstLevelTreeNode->setChildNodes($expectedStorageOfSecondLevelChildren);
     $expectedStorage->append($expectedFirstLevelTreeNode);
     $this->initializeSubjectMock(array('getRelatedRecords', 'getRootUid'));
     $this->subject->_set('levelMaximum', 2);
     $this->subject->expects($this->at(0))->method('getRelatedRecords')->will($this->returnValue(array(1)));
     $this->subject->expects($this->at(1))->method('getRelatedRecords')->will($this->returnValue(array(2)));
     $storage = $this->subject->_call('getChildrenOf', $this->treeData, 1);
     $this->assertEquals($expectedStorage, $storage);
 }
Ejemplo n.º 2
0
 /**
  * Adds a node to the internal list in a sorted approach
  *
  * @param \TYPO3\CMS\Backend\Tree\TreeNode $node
  * @return void
  */
 public function append($node)
 {
     parent::append($node);
     $this->asort();
     $this->normalize();
 }
 /**
  * Adds a node to the internal list in a sorted approach
  *
  * @param \TYPO3\CMS\Backend\Tree\TreeNode $node
  * @return void
  */
 public function append(\TYPO3\CMS\Backend\Tree\TreeNode $node)
 {
     parent::append($node);
     $this->asort();
     $this->normalize();
 }