/** * Get the order address. If only an order address id is available, will * attempt to load the order address. * * @return Mage_Sales_Model_Order_Address */ public function getOrderAddress() { if (!$this->hasOrderAddress()) { $this->setOrderAddress($this->_multishippingFactory->loadAddressForItem($this)); } return $this->getData('order_address'); }
/** * When loading an address for an virtual item without an order address id, * the default billing address of the order associated with the item * should be used. */ public function testLoadAddressForItemDefaultVirtualAddress() { $shippingAddress = $this->getModelMock('sales/order_address'); $billingAddress = $this->getModelMock('sales/order_address'); $order = $this->getModelMock('sales/order', ['getShippingAddress', 'getBillingAddress']); $order->method('getShippingAddress')->will($this->returnValue($shippingAddress)); $order->method('getBillingAddress')->will($this->returnValue($billingAddress)); $item = $this->getModelMock('sales/order_item', ['getOrderAddressId', 'getOrder', 'getIsVirtual']); $item->method('getOrderAddressId')->will($this->returnValue(null)); $item->method('getOrder')->will($this->returnValue($order)); $item->method('getIsVirtual')->will($this->returnValue(true)); $this->assertSame($billingAddress, $this->_multishippingFactory->loadAddressForItem($item)); }