/**
  * 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();
 }
示例#2
0
 /**
  * Set current VDE theme
  */
 protected function _setTheme()
 {
     $themeId = $this->_backendSession->getData('theme_id');
     if ($themeId !== null) {
         $path = $this->_designPackage->getConfigPathByArea(Mage_Core_Model_App_Area::AREA_FRONTEND);
         $this->_application->getStore()->setConfig($path, $themeId);
     }
 }
示例#3
0
 public function testUpdateNavigationMode()
 {
     $this->_setAdditionalExpectations();
     $request = $this->getMock('Mage_Core_Controller_Request_Http', array('getParam', 'isAjax', 'getPathInfo'), array(), '', false);
     $controller = $this->getMock('Mage_Adminhtml_Controller_Action', array('getFullActionName'), array(), '', false);
     $request->expects($this->once())->method('getParam')->with('handle', '')->will($this->returnValue(''));
     $request->expects($this->once())->method('isAjax')->will($this->returnValue(false));
     $controller->expects($this->once())->method('getFullActionName')->will($this->returnValue('index'));
     $this->_backendSession->expects($this->at(0))->method('setData')->with('vde_current_handle', 'index');
     $request->expects($this->once())->method('getPathInfo')->will($this->returnValue('/'));
     $this->_backendSession->expects($this->at(1))->method('setData')->with('vde_current_url', '/');
     $this->_backendSession->expects($this->at(2))->method('setData')->with('vde_current_mode', Mage_DesignEditor_Model_State::MODE_NAVIGATION);
     $this->_urlModelFactory->expects($this->once())->method('replaceClassName')->with(self::URL_MODEL_NAVIGATION_MODE_CLASS_NAME);
     $this->_layoutFactory->expects($this->once())->method('createLayout')->with(array('area' => self::AREA_CODE), self::LAYOUT_NAVIGATION_CLASS_NAME);
     $this->_objectManager->expects($this->once())->method('addAlias')->with(self::LAYOUT_UPDATE_RESOURCE_MODEL_CORE_CLASS_NAME, self::LAYOUT_UPDATE_RESOURCE_MODEL_VDE_CLASS_NAME);
     $this->_model->update(self::AREA_CODE, $request, $controller);
 }