/** * @Given /^I am logged in as "([^"]+)" administrator$/ */ public function iAmLoggedInAsAdministrator($email) { $user = $this->userRepository->findOneByEmail($email); Assert::notNull($user); $this->securityService->logIn($user); $this->sharedStorage->set('admin', $user); }
/** * @When I delete the account of :email user */ public function iDeleteAccount($email) { $user = $this->userRepository->findOneByEmail($email); $this->sharedStorage->set('deleted_user', $user); $this->customerShowPage->open(['id' => $user->getCustomer()->getId()]); $this->customerShowPage->deleteAccount(); }
function it_deletes_account(UserRepositoryInterface $userRepository, ShowPageInterface $customerShowPage, SharedStorageInterface $sharedStorage, UserInterface $user, CustomerInterface $customer) { $userRepository->findOneByEmail('*****@*****.**')->willReturn($user); $sharedStorage->set('deleted_user', $user)->shouldBeCalled(); $user->getCustomer()->willReturn($customer); $customer->getId()->willReturn(1); $customerShowPage->open(['id' => 1])->shouldBeCalled(); $customerShowPage->deleteAccount()->shouldBeCalled(); $this->iDeleteAccount('*****@*****.**'); }
/** * @Given the account of :email was deleted */ public function accountWasDeleted($email) { $user = $this->userRepository->findOneByEmail($email); $this->sharedStorage->set('customer', $user->getCustomer()); $this->userRepository->remove($user); }
/** * @Given a verification email has already been sent to :email */ public function aVerificationEmailHasBeenSentTo($email) { $user = $this->userRepository->findOneByEmail($email); $this->prepareUserVerification($user); }
/** * @Given I am logged in as :email */ public function iAmLoggedInAs($email) { $user = $this->userRepository->findOneByEmail($email); Assert::notNull($user); $this->securityService->logIn($user); }
function it_loads_user_by_email(UserRepositoryInterface $userRepository, CanonicalizerInterface $canonicalizer, User $user) { $canonicalizer->canonicalize('*****@*****.**')->willReturn('*****@*****.**'); $userRepository->findOneByEmail('*****@*****.**')->willReturn($user); $this->loadUserByUsername('*****@*****.**')->shouldReturn($user); }