/**
  * @test
  */
 public function getUserWorkspaceNameReturnsTheUsersWorkspaceNameIfAUserIsLoggedIn()
 {
     $mockAccount = $this->getMockBuilder('TYPO3\\Flow\\Security\\Account')->disableOriginalConstructor()->getMock();
     $mockAccount->expects($this->atLeastOnce())->method('getAccountIdentifier')->will($this->returnValue('The UserName'));
     $this->mockSecurityContext->expects($this->atLeastOnce())->method('getAccount')->will($this->returnValue($mockAccount));
     $this->assertSame('user-TheUserName', $this->userService->getUserWorkspaceName());
 }
 /**
  * Returns a specific URI string to redirect to after the login; or NULL if there is none.
  *
  * @param ActionRequest $actionRequest
  * @return string
  */
 public function getAfterLoginRedirectionUri(ActionRequest $actionRequest)
 {
     $user = $this->userService->getBackendUser();
     if ($user === null) {
         return null;
     }
     $workspaceName = $this->userService->getUserWorkspaceName();
     $this->createWorkspaceAndRootNodeIfNecessary($workspaceName);
     $uriBuilder = new UriBuilder();
     $uriBuilder->setRequest($actionRequest);
     $uriBuilder->setFormat('html');
     $uriBuilder->setCreateAbsoluteUri(true);
     $contentContext = $this->createContext($workspaceName);
     $lastVisitedNode = $this->getLastVisitedNode($workspaceName);
     if ($lastVisitedNode !== null) {
         return $uriBuilder->uriFor('show', array('node' => $lastVisitedNode), 'Frontend\\Node', 'TYPO3.Neos');
     }
     return $uriBuilder->uriFor('show', array('node' => $contentContext->getCurrentSiteNode()), 'Frontend\\Node', 'TYPO3.Neos');
 }