/** * Create url model instance that will be used instead of Mage_Core_Model_Url in navigation mode */ protected function _injectUrlModel($mode) { switch ($mode) { case self::MODE_DESIGN: $this->_urlModelFactory->replaceClassName(self::URL_MODEL_DESIGN_MODE_CLASS_NAME); break; case self::MODE_NAVIGATION: default: $this->_urlModelFactory->replaceClassName(self::URL_MODEL_NAVIGATION_MODE_CLASS_NAME); break; } }
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); }
public function testCreateFromArray() { $this->_objectManager->expects($this->once())->method('create')->with('Mage_Core_Model_Url', array(), false)->will($this->returnValue('ModelInstance')); $this->assertEquals('ModelInstance', $this->_model->createFromArray()); }