public function testSavePackstationInformation() { $params = array('shipping' => array('ship_to_packstation' => true, 'street' => array('packstation 123'), 'dhlaccount' => '1234')); $addressMock = $this->getModelMock('sales/quote_address', array('save')); $quote = new Varien_Object(); $quote->setId(1); $quote->setShippingAddress($addressMock); $checkoutSessionMock = $this->getModelMock('checkout/session', array('getQuote', 'init', 'save')); $checkoutSessionMock->expects($this->any())->method('getQuote')->will($this->returnValue($quote)); $this->replaceByMock('model', 'checkout/session', $checkoutSessionMock); Mage::app()->getFrontController()->getRequest()->setPost($params); $observer = Mage::getModel('dhlaccount/observer'); $event = new Varien_Event_Observer(); $observer->savePackstationInformation($event); $addressData = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress(); $this->assertEquals('1234', $addressData['dhlaccount']); $this->assertEquals('Packstation packstation 123', $addressData['street']); $this->assertEquals('1', $addressData['ship_to_packstation']); }