function it_does_not_save_addresses_for_guest_order(CustomerAddressAdderInterface $addressAdder, OrderInterface $order, CustomerInterface $customer)
 {
     $order->getCustomer()->willReturn($customer);
     $customer->getUser()->willReturn(null);
     $addressAdder->add($customer, Argument::any())->shouldNotBeCalled();
     $addressAdder->add($customer, Argument::any())->shouldNotBeCalled();
     $this->saveAddresses($order);
 }
 /**
  * @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);
 }