public function testProceed()
 {
     $user = UserEntityProvider::createEntityWithRandomData();
     $userId = $user->getId();
     $this->userRepositoryMock->expects($this->once())->method('find')->with($userId)->willReturn($user);
     $this->authenticationServiceMock->expects($this->once())->method('getStorage')->willReturnSelf();
     $this->authenticationServiceMock->expects($this->once())->method('write')->with($user->getId());
     $this->testedObject->proceed($userId);
 }
 public function indexAction()
 {
     $userId = $this->params()->fromRoute('userId', null);
     try {
         $this->service->proceed($userId);
         $this->notification()->info('User email verified successfully. You need to set a password to log in.');
         return $this->redirect()->toRoute('lang/my', array('action' => 'password'));
     } catch (Exception\UserNotFoundException $e) {
         $this->notification()->danger('User cannot be found');
     } catch (\Exception $e) {
         $this->logger->crit($e);
         $this->notification()->danger('An unexpected error has occurred, please contact your system administrator');
     }
     return $this->redirect()->toRoute('lang/register');
 }