/** * Test for Mage_Adminhtml_Catalog_ProductController::saveAction */ public function testSaveActionWithDangerRequest() { $data = array('product' => array('entity_id' => 234)); $productMock = $this->getMockBuilder('Mage_Catalog_Model_Product')->setMethods(array('getIdFieldName', 'save', 'getSku'))->disableOriginalConstructor()->getMock(); $productMock->expects($this->any())->method('getIdFieldName')->will($this->returnValue('entity_id')); $productMock->expects($this->never())->method('save'); $this->_sessionMock->expects($this->once())->method('addError')->with('Unable to save product')->will($this->returnValue($this->_sessionMock)); $this->_sessionMock->expects($this->once())->method('setProductData'); $this->_request->expects($this->any())->method('getPost')->will($this->returnValue($data)); $this->_controller->expects($this->any())->method('_initProductSave')->will($this->returnValue($productMock)); $this->_controller->saveAction(); }