/**
  * Loads tree for a given namespace
  *
  * @param string $namespace Namespace to build tree for
  * @return Tx_PtExtbase_Tree_Tree Tree build for given namespace
  */
 public function loadTreeByNamespace($namespace)
 {
     if ($this->treeContext->respectEnableFields()) {
         return $this->treeBuilder->buildTreeForNamespaceWithoutInaccessibleSubtrees($namespace);
     } else {
         return $this->treeBuilder->buildTreeForNamespace($namespace);
     }
 }
 /** @test */
 public function buildTreeForNamespaceThrowsExceptionIfNodesAreNotGivenInDescendingLeftValueOrder()
 {
     $repositoryMock = $this->buildRepositoryMock();
     $repositoryMock->expects($this->once())->method('findByNamespace')->will($this->returnValue(self::buildWrongSortedSetOfNodes()));
     $treeBuilder = new Tx_PtExtbase_Tree_TreeBuilder($repositoryMock);
     try {
         $treeBuilder->buildTreeForNamespace('no_matter_what_namespace');
     } catch (Exception $e) {
         $this->assertTrue(true);
         return;
     }
     $this->fail('No Exception was thrown.');
 }