public function testGetDefaultWeightWithItemCollection() { $block = new Dhl_Intraship_Block_Adminhtml_Sales_Order_Shipment_Create_Intraship_Packages(); $shippingAddress = new Varien_Object(array('country_id' => 'NR')); $config = $this->getModelMock('intraship/config', array('useProductWeightAsDefault', 'getWeightDefault', 'getProductTypesForWeightCalculation')); $config->expects($this->any())->method('getWeightDefault')->will($this->returnValue(42)); $config->expects($this->any())->method('useProductWeightAsDefault')->will($this->returnValue(true)); $config->expects($this->any())->method('getProductTypesForWeightCalculation')->will($this->returnValue(array('foo'))); $this->replaceByMock('model', 'intraship/config', $config); $order = new Varien_Object(); $items = $this->getItemsCollection(); $order->setItemsCollection($items); $shipment = $this->getModelMock('sales/order_shipment', array('getOrder', 'getShippingAddress')); $shipment->expects($this->any())->method('getShippingAddress')->will($this->returnValue($shippingAddress)); $shipment->expects($this->any())->method('getOrder')->will($this->returnValue($order)); Mage::unregister('current_shipment'); Mage::register('current_shipment', $shipment); $this->assertEquals(13, $block->getDefaultWeight()); }