function it_validates_if_user_with_given_email_is_already_registered($userRepository, $tokenStorage, $authorizationChecker, $context, TokenInterface $token, UniqueReviewerEmail $constraint, ReviewInterface $review, CustomerInterface $customer, CustomerInterface $existingUser)
 {
     $tokenStorage->getToken()->willReturn($token);
     $authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED')->willReturn(false);
     $review->getAuthor()->willReturn($customer);
     $customer->getEmail()->willReturn('*****@*****.**');
     $userRepository->findOneByEmail('*****@*****.**')->willReturn($existingUser);
     $constraint->message = 'This email is already registered. Please log in.';
     $context->addViolationAt('author', 'This email is already registered. Please log in.', [], null)->shouldBeCalled();
     $this->validate($review, $constraint);
 }
 function it_validates_if_user_with_given_email_is_already_registered(UserRepository $userRepository, TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker, ExecutionContextInterface $executionContextInterface, ConstraintViolationBuilderInterface $constraintViolationBuilder, TokenInterface $token, ReviewInterface $review, CustomerInterface $customer, CustomerInterface $existingUser)
 {
     $constraint = new UniqueReviewerEmail();
     $tokenStorage->getToken()->willReturn($token);
     $authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED')->willReturn(false);
     $review->getAuthor()->willReturn($customer);
     $customer->getEmail()->willReturn('*****@*****.**');
     $userRepository->findOneByEmail('*****@*****.**')->willReturn($existingUser);
     $executionContextInterface->buildViolation($constraint->message)->shouldBeCalled()->willReturn($constraintViolationBuilder);
     $constraintViolationBuilder->atPath('author')->shouldBeCalled()->willReturn($constraintViolationBuilder);
     $constraintViolationBuilder->addViolation()->shouldBeCalled();
     $this->validate($review, $constraint);
 }