/** * Create layout instance that will be used as main layout for whole system * * @param string $mode * @param string $areaCode */ protected function _injectLayout($mode, $areaCode) { switch ($mode) { case self::MODE_DESIGN: $this->_layoutFactory->createLayout(array('area' => $areaCode), self::LAYOUT_DESIGN_CLASS_NAME); break; case self::MODE_NAVIGATION: default: $this->_layoutFactory->createLayout(array('area' => $areaCode), self::LAYOUT_NAVIGATION_CLASS_NAME); break; } }
public function testCreateLayoutGetSharedInstance() { $this->_arguments = array('area' => 'TestArea'); $this->_objectManager->expects($this->once())->method('hasSharedInstance')->with(self::CLASS_NAME)->will($this->returnValue(true)); $modelLayout = $this->getMock(self::CLASS_NAME, array('getArea'), array(), '', false); $this->_objectManager->expects($this->at(1))->method('get')->with(self::CLASS_NAME)->will($this->returnValue($modelLayout)); $modelLayout->expects($this->any())->method('getArea')->will($this->returnValue('TestArea')); $this->_objectManager->expects($this->never())->method('removeSharedInstance'); $this->_objectManager->expects($this->never())->method('create'); $this->_objectManager->expects($this->never())->method('addSharedInstance'); $this->_objectManager->expects($this->at(2))->method('get')->with(self::CLASS_NAME)->will($this->returnValue($modelLayout)); $this->assertEquals($modelLayout, $this->_model->createLayout($this->_arguments)); }
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); }
/** * Retrieve current layout object * * @return Mage_Core_Model_Layout */ public function getLayout() { return $this->_layoutFactory->createLayout(array('area' => $this->_currentArea)); }