예제 #1
0
 /**
  * @test
  */
 public function getNodesSetsIsMountPointField()
 {
     $subpages = array(array('uid' => 1, 'isMountPoint' => FALSE), array('uid' => 2, 'isMountPoint' => TRUE), array('uid' => 3));
     $subpagesWithWorkspaceOverlay = array(array('uid' => 1, 'title' => 'Home'), array('uid' => 2, 'title' => 'service'), array('uid' => 3, 'title' => 'contact'));
     $fixture = $this->getMock('TYPO3\\CMS\\Backend\\Tree\\Pagetree\\DataProvider', array('getSubpages', 'getRecordWithWorkspaceOverlay'));
     $fixture->expects($this->once())->method('getSubpages')->will($this->returnValue($subpages));
     $fixture->expects($this->at(1))->method('getRecordWithWorkspaceOverlay')->with(1)->will($this->returnValue($subpagesWithWorkspaceOverlay[0]));
     $fixture->expects($this->at(2))->method('getRecordWithWorkspaceOverlay')->with(2)->will($this->returnValue($subpagesWithWorkspaceOverlay[1]));
     $fixture->expects($this->at(3))->method('getRecordWithWorkspaceOverlay')->with(3)->will($this->returnValue($subpagesWithWorkspaceOverlay[2]));
     $node = new \TYPO3\CMS\Backend\Tree\TreeNode();
     $node->setId(12);
     $nodeCollection = $fixture->getNodes($node);
     $isMountPointResult = array();
     /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */
     foreach ($nodeCollection as $node) {
         $isMountPointResult[] = $node->isMountPoint();
     }
     $this->assertSame(array(FALSE, TRUE, FALSE), $isMountPointResult);
 }
예제 #2
0
 /**
  * @test
  */
 public function compareNodes()
 {
     $node = new \TYPO3\CMS\Backend\Tree\TreeNode(array('id' => '15'));
     $otherNode = new \TYPO3\CMS\Backend\Tree\TreeNode(array('id' => '5'));
     $compareResult = $node->compareTo($otherNode);
     $otherNode->setId('25');
     $compareResult = $node->compareTo($otherNode);
     $this->assertSame(-1, $compareResult);
     $otherNode->setId('15');
     $compareResult = $node->compareTo($otherNode);
     $this->assertSame(0, $compareResult);
 }