function it_sets_canonical_email_when_initializing_customer($canonicalizer, CustomerInterface $customer) { $customer->getEmail()->willReturn('*****@*****.**'); $canonicalizer->canonicalize('*****@*****.**')->willReturn('*****@*****.**'); $customer->setEmailCanonical('*****@*****.**')->shouldBeCalled(); $this->initialize($customer); }
/** * Get the first wishlist for the customer, if any. * * @param CustomerInterface $customer * @return WishlistInterface|null */ public function getFirstForCustomer(CustomerInterface $customer) { // Get query builder $queryBuilder = $this->createQueryBuilder('o'); // Apply customer condition $queryBuilder->where('IDENTITY(o.customer) = :customerId'); $queryBuilder->setParameter('customerId', $customer->getId()); $queryBuilder->orderBy('o.createdAt', 'asc'); $queryBuilder->setMaxResults(1); // Get the result return $queryBuilder->getQuery()->getOneOrNullResult(); }
/** * {@inheritdoc} */ public function getUser() { if (null === $this->customer) { return null; } return $this->customer->getUser(); }
function it_does_nothing_on_customer_update_when_no_user_associated(OnFlushEventArgs $onFlushEventArgs, EntityManager $entityManager, UnitOfWork $unitOfWork, CustomerInterface $customer) { $onFlushEventArgs->getEntityManager()->willReturn($entityManager); $entityManager->getUnitOfWork()->willReturn($unitOfWork); $unitOfWork->getScheduledEntityInsertions()->willReturn([]); $unitOfWork->getScheduledEntityUpdates()->willReturn([$customer]); $customer->getUser()->willReturn(null); $customer->getEmail()->willReturn('*****@*****.**'); $entityManager->persist(Argument::any())->shouldNotBeCalled(); $unitOfWork->recomputeSingleEntityChangeSet(Argument::any())->shouldNotBeCalled(); $this->onFlush($onFlushEventArgs); }
/** * @param CustomerInterface $customer */ protected function assignUser(CustomerInterface $customer = null) { if (null !== $customer) { $customer->setUser($this); } }
/** * @Then the customer :customer should have an account created * @Then /^(this customer) should have an account created$/ */ public function theyShouldHaveAnAccountCreated(CustomerInterface $customer) { Assert::notNull($customer->getUser()->getPassword(), 'Customer should have an account, but they do not.'); }
/** * @When I view details of the customer :customer */ public function iViewDetailsOfTheCustomer(CustomerInterface $customer) { $this->showPage->open(['id' => $customer->getId()]); }