/**
  * Handles the given command.
  *
  * @param WithoutOldPasswordChangeUserPasswordCommand $aCommand The command
  *
  * @throws UserDoesNotExistException when the user does not exist
  */
 public function __invoke(WithoutOldPasswordChangeUserPasswordCommand $aCommand)
 {
     $user = $this->repository->userOfEmail(new UserEmail($aCommand->email()));
     if (null === $user) {
         throw new UserDoesNotExistException();
     }
     $user->changePassword(UserPassword::fromPlain($aCommand->newPlainPassword(), $this->encoder));
     $this->repository->persist($user);
 }
 function it_does_not_changes_password_because_the_does_not_exist(WithoutOldPasswordChangeUserPasswordCommand $command, UserRepository $repository)
 {
     $command->email()->shouldBeCalled()->willReturn('*****@*****.**');
     $repository->userOfEmail(new UserEmail('*****@*****.**'))->shouldBeCalled()->willReturn(null);
     $this->shouldThrow(UserDoesNotExistException::class)->during__invoke($command);
 }