function it_sets_canonical_email_when_initializing_customer($canonicalizer, CustomerInterface $customer)
 {
     $customer->getEmail()->willReturn('*****@*****.**');
     $canonicalizer->canonicalize('*****@*****.**')->willReturn('*****@*****.**');
     $customer->setEmailCanonical('*****@*****.**')->shouldBeCalled();
     $this->initialize($customer);
 }
 /**
  * {@inheritdoc}
  */
 public function add(CustomerInterface $customer, AddressInterface $address)
 {
     foreach ($customer->getAddresses() as $customerAddress) {
         if ($this->addressComparator->equal($customerAddress, $address)) {
             return;
         }
     }
     $customer->addAddress($address);
 }
 function it_adds_an_address_when_different_than_the_ones_present_on_the_customer(AddressComparatorInterface $addressComparator, CustomerInterface $customer, AddressInterface $customerAddress, AddressInterface $newAddress, Collection $addresses, \Iterator $iterator)
 {
     $iterator->rewind()->shouldBeCalled();
     $iterator->valid()->willReturn(true);
     $iterator->current()->willReturn($customerAddress);
     $iterator->valid()->willReturn(false);
     $addresses->getIterator()->willReturn($iterator);
     $customer->getAddresses()->willReturn($addresses);
     $addressComparator->equal($customerAddress, $newAddress)->willReturn(false);
     $customer->addAddress($newAddress)->shouldBeCalled();
     $this->add($customer, $newAddress);
 }
 /**
  * @Then I should see a single order from customer :customer
  */
 public function iShouldSeeASingleOrderFromCustomer(CustomerInterface $customer)
 {
     Assert::true($this->indexPage->isSingleResourceOnPage(['customer' => $customer->getEmail()]), sprintf('Cannot find order for customer "%s" in the list.', $customer->getEmail()));
 }
Beispiel #5
0
 /**
  * @param CustomerInterface $customer
  */
 protected function assignUser(CustomerInterface $customer = null)
 {
     if (null !== $customer) {
         $customer->setUser($this);
     }
 }
Beispiel #6
0
 /**
  * @Given /^(the customer) belongs to (group "([^"]+)")$/
  */
 public function theCustomerBelongsToGroup(CustomerInterface $customer, CustomerGroupInterface $customerGroup)
 {
     $customer->setGroup($customerGroup);
     $this->customerManager->flush();
 }
Beispiel #7
0
 /**
  * {@inheritdoc}
  */
 public function findByCustomer(CustomerInterface $customer)
 {
     return $this->createByCustomerIdQueryBuilder($customer->getId())->getQuery()->getResult();
 }
Beispiel #8
0
 /**
  * @When I verify my account using link sent to :customer
  */
 public function iVerifyMyAccount(CustomerInterface $customer)
 {
     $user = $customer->getUser();
     Assert::notNull($user, 'No account for given customer');
     $this->iUseItToVerify($user);
 }
 /**
  * @When I change the password of user :customer to :newPassword
  */
 public function iChangeThePasswordOfUserTo(CustomerInterface $customer, $newPassword)
 {
     $this->updatePage->open(['id' => $customer->getId()]);
     $this->updatePage->changePassword($newPassword);
     $this->updatePage->saveChanges();
 }
Beispiel #10
0
 /**
  * @param CustomerInterface $customer
  * @param AddressInterface $address
  */
 private function setDefaultAddressOfCustomer(CustomerInterface $customer, AddressInterface $address)
 {
     $customer->setDefaultAddress($address);
     $this->customerManager->flush();
 }
Beispiel #11
0
 /**
  * @Given /^(the customer) subscribed to the newsletter$/
  */
 public function theCustomerSubscribedToTheNewsletter(CustomerInterface $customer)
 {
     $customer->setSubscribedToNewsletter(true);
     $this->customerManager->flush();
 }
Beispiel #12
0
 /**
  * @Given /^(his) billing (address is "(?:[^"]+)", "(?:[^"]+)", "(?:[^"]+)", "(?:[^"]+)" for "(?:[^"]+)")$/
  */
 public function heHasBillingAddress(CustomerInterface $customer, AddressInterface $address)
 {
     $customer->setBillingAddress($address);
     $this->customerManager->flush();
 }
 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('*****@*****.**');
     $unitOfWork->recomputeSingleEntityChangeSet(Argument::cetera())->shouldNotBeCalled();
     $this->onFlush($onFlushEventArgs);
 }