/** @test */
 public function visitorSetsClassToSelectedInSingleMode()
 {
     $visitors[] = $this->accessibleProxy;
     $this->accessibleProxy->setMultipleSelect(false);
     $this->accessibleProxy->setSelection(5);
     $arrayTreeWriter = new Tx_PtExtbase_Tree_ArrayTreeWriter($visitors, $this->accessibleProxy);
     $tree = $arrayTreeWriter->writeTree($this->getTestTree());
     $this->assertEquals('', $tree['cls']);
     $this->assertEquals('', $tree['children'][0]['cls']);
     $this->assertEquals('selectedNode', $tree['children'][1]['cls']);
 }
Пример #2
0
 /**
  * Returns JSON notation of given tree
  *
  * @param Tx_PtExtbase_Tree_TreeInterface $tree
  * @return string JSON encoding of tree
  */
 public function writeTree(Tx_PtExtbase_Tree_TreeInterface $tree)
 {
     $nodeArray = parent::writeTree($tree);
     return '[' . json_encode($nodeArray) . ']';
 }