function it_does_not_allow_to_delete_currently_logged_user(GenericEvent $event, UserInterface $userToBeDeleted, UserInterface $currentlyLoggedInUser, $tokenStorage, $flashBag, TokenInterface $token)
 {
     $event->getSubject()->willReturn($userToBeDeleted);
     $userToBeDeleted->getId()->willReturn(1);
     $tokenStorage->getToken()->willReturn($token);
     $currentlyLoggedInUser->getId()->willReturn(1);
     $token->getUser()->willReturn($currentlyLoggedInUser);
     $event->stopPropagation()->shouldBeCalled();
     $flashBag->add('error', 'Cannot remove currently logged in user.')->shouldBeCalled();
     $this->deleteUser($event);
 }
 function it_refreshes_user($userRepository, UserInterface $user, UserInterface $refreshedUser)
 {
     $userRepository->find(1)->willReturn($refreshedUser);
     $user->getId()->willReturn(1);
     $this->refreshUser($user)->shouldReturn($refreshedUser);
 }