Ejemplo n.º 1
0
 public function testSearchById()
 {
     $tree = new \Magento\Framework\Data\Tree();
     $node1 = new \Magento\Framework\Data\Tree\Node(['id' => 'node1'], 'id', $tree);
     $this->collection->add($node1);
     $node2 = new \Magento\Framework\Data\Tree\Node(['id' => 'node2'], 'id', $tree);
     $this->collection->add($node2);
     $this->assertSame($this->collection->lastNode(), $node2);
     $node3 = new \Magento\Framework\Data\Tree\Node(['id' => 'node3'], 'id', $tree);
     $this->collection->add($node3);
     $this->assertSame($this->collection->searchById('node2'), $node2);
 }
Ejemplo n.º 2
0
 /**
  * @return mixed
  */
 public function getLastChild()
 {
     return $this->_childNodes->lastNode();
 }