/**
  * @param OrderInterface $order
  */
 public function saveAddresses(OrderInterface $order)
 {
     /** @var CustomerInterface $customer */
     $customer = $order->getCustomer();
     $shippingAddress = $order->getShippingAddress();
     $billingAddress = $order->getBillingAddress();
     $this->addressAdder->add($customer, clone $billingAddress);
     $this->addressAdder->add($customer, clone $shippingAddress);
 }
 function it_saves_addresses_from_given_order(CustomerAddressAdderInterface $addressAdder, OrderInterface $order, CustomerInterface $customer, AddressInterface $shippingAddress, AddressInterface $billingAddress)
 {
     $order->getCustomer()->willReturn($customer);
     $order->getShippingAddress()->willReturn($shippingAddress);
     $order->getBillingAddress()->willReturn($billingAddress);
     $addressAdder->add($customer, clone $shippingAddress)->shouldBeCalled();
     $addressAdder->add($customer, clone $billingAddress)->shouldBeCalled();
     $this->saveAddresses($order);
 }
예제 #3
0
 /**
  * @When I delete the order :order
  */
 public function iDeleteTheOrder(OrderInterface $order)
 {
     $adjustmentsId = [];
     foreach ($order->getAdjustments() as $adjustment) {
         $adjustmentsId[] = $adjustment->getId();
     }
     $this->sharedStorage->set('deleted_adjustments', $adjustmentsId);
     $this->sharedStorage->set('deleted_addresses', [$order->getShippingAddress()->getId(), $order->getBillingAddress()->getId()]);
     $this->sharedStorage->set('order_id', $order->getId());
     $this->orderRepository->remove($order);
 }