/** * Retrieve address items collection * * @return Mage_Sales_Model_Resource_Order_Item_Collection */ public function getItemsCollection() { if (!$this->_items) { $this->_items = $this->_multishippingFactory->createItemCollectionForAddress($this); } return $this->_items; }
/** * When creating an item collection for a secondary shipping address, items * should be filtered to only include items with a matching order id, * matching order address id, and non-virtual items. * * @param bool * @param string * @param bool * @dataProvider providePrimaryAddressConfigurations */ public function testCreateItemCollectionSetItemData() { $addressId = 3; $orderId = 9; $addressType = Mage_Sales_Model_Order_Address::TYPE_SHIPPING; $address = $this->_stubAddress($addressId, false, $orderId, $addressType); $itemCollection = $this->_mockAndReplaceItemCollection(); $itemCollection->method('addFieldToFilter')->will($this->returnSelf()); // Side-effect test: ensure that whenever an item collection is created, // all items in the collection have the order address instance and order // address id for the address the collection is being created for - // ensures the items are linked to the address. $itemCollection->expects($this->once())->method('setDataToAll')->with($this->identicalTo(['order_address' => $address, 'order_address_id' => $addressId]))->will($this->returnSelf()); $this->assertSame($itemCollection, $this->_multishippingFactory->createItemCollectionForAddress($address)); }