/**
  * @test
  */
 public function getPersonalWorkspaceNameReturnsTheUsersWorkspaceNameIfAUserIsLoggedIn()
 {
     $mockUser = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Model\\User')->disableOriginalConstructor()->getMock();
     $this->mockUserDomainService->expects($this->atLeastOnce())->method('getCurrentUser')->will($this->returnValue($mockUser));
     $this->mockUserDomainService->expects($this->atLeastOnce())->method('getUserName')->with($mockUser)->will($this->returnValue('TheUserName'));
     $this->assertSame('user-TheUserName', $this->userService->getPersonalWorkspaceName());
 }
 /**
  * Displays the backend interface
  *
  * @param NodeInterface $node The node that will be displayed on the first tab
  * @return void
  */
 public function indexAction(NodeInterface $node = null)
 {
     $this->contentCache->flush();
     $this->session->start();
     $this->session->putData('__cheEnabled__', true);
     if ($user = $this->userService->getBackendUser()) {
         $workspaceName = $this->userService->getPersonalWorkspaceName();
         $contentContext = $this->createContext($workspaceName);
         $contentContext->getWorkspace();
         $this->persistenceManager->persistAll();
         $siteNode = $contentContext->getCurrentSiteNode();
         if ($node === null) {
             $node = $siteNode;
         }
         $this->view->assign('user', $user);
         $this->view->assign('documentNode', $node);
         $this->view->assign('site', $node);
         $this->view->assign('translations', $this->xliffService->getCachedJson(new Locale($this->userService->getInterfaceLanguage())));
         return;
     }
     $this->redirectToUri($this->uriBuilder->uriFor('index', array(), 'Login', 'TYPO3.Neos'));
 }