/** * @param ShopUserInterface $user */ private function handleUserVerificationToken(ShopUserInterface $user) { $token = $this->tokenGenerator->generate(); $user->setEmailVerificationToken($token); $this->userManager->persist($user); $this->userManager->flush(); $this->eventDispatcher->dispatch(UserEvents::REQUEST_VERIFICATION_TOKEN, new GenericEvent($user)); }
/** * @param ShopUserInterface $user */ private function blame(ShopUserInterface $user) { $cart = $this->getCart(); if (null === $cart) { return; } $cart->setCustomer($user->getCustomer()); $this->cartManager->persist($cart); $this->cartManager->flush(); }
function it_logs_user_in(SessionInterface $session, CookieSetterInterface $cookieSetter, ShopUserInterface $shopUser) { $shopUser->getRoles()->willReturn(['ROLE_USER']); $shopUser->getPassword()->willReturn('xyz'); $shopUser->serialize()->willReturn('serialized_user'); $session->set('_security_shop', Argument::any())->shouldBeCalled(); $session->save()->shouldBeCalled(); $session->getName()->willReturn('MOCKEDSID'); $session->getId()->willReturn('xyzc123'); $cookieSetter->setCookie('MOCKEDSID', 'xyzc123')->shouldBeCalled(); $this->logIn($shopUser); }
function it_does_not_update_usernames_when_customer_emails_are_the_same(OnFlushEventArgs $onFlushEventArgs, EntityManager $entityManager, UnitOfWork $unitOfWork, CustomerInterface $customer, ShopUserInterface $user, ClassMetadata $userMetadata) { $onFlushEventArgs->getEntityManager()->willReturn($entityManager); $entityManager->getUnitOfWork()->willReturn($unitOfWork); $unitOfWork->getScheduledEntityInsertions()->willReturn([]); $unitOfWork->getScheduledEntityUpdates()->willReturn([$customer]); $user->getUsername()->willReturn('*****@*****.**'); $user->getUsernameCanonical()->willReturn('*****@*****.**'); $customer->getUser()->willReturn($user); $customer->getEmail()->willReturn('*****@*****.**'); $customer->getEmailCanonical()->willReturn('*****@*****.**'); $user->setUsername(Argument::any())->shouldNotBeCalled(); $user->setUsernameCanonical(Argument::any())->shouldNotBeCalled(); $unitOfWork->recomputeSingleEntityChangeSet(Argument::cetera())->shouldNotBeCalled(); $this->onFlush($onFlushEventArgs); }
function it_should_connect_oauth_account_with_given_user($userManager, FactoryInterface $oauthFactory, ShopUserInterface $user, UserResponseInterface $response, ResourceOwnerInterface $resourceOwner, UserOAuthInterface $oauth) { $resourceOwner->getName()->willReturn('google'); $response->getEmail()->willReturn(null); $response->getUsername()->willReturn('username'); $response->getResourceOwner()->willReturn($resourceOwner); $response->getAccessToken()->willReturn('access_token'); $response->getRefreshToken()->willReturn('refresh_token'); $oauthFactory->createNew()->willReturn($oauth); $oauth->setIdentifier('username'); $oauth->setProvider('google'); $oauth->setAccessToken('access_token'); $oauth->setRefreshToken('refresh_token'); $user->addOAuthAccount($oauth)->shouldBeCalled(); $userManager->persist($user)->shouldBeCalled(); $userManager->flush()->shouldBeCalled(); $this->connect($user, $response); }
/** * @Given /^(I) have an (address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+"(?:|, "[^"]+")) in my address book$/ */ public function iHaveAnAddressInAddressBook(ShopUserInterface $user, AddressInterface $address) { /** @var CustomerInterface $customer */ $customer = $user->getCustomer(); $this->thisCustomerHasAnAddressInAddressBook($customer, $address); }
/** * @When /^(I) try to verify my account using the link from this email$/ */ public function iUseItToVerify(ShopUserInterface $user) { $this->verificationPage->verifyAccount($user->getEmailVerificationToken()); }