예제 #1
0
 /**
  * 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;
     }
 }
예제 #2
0
 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));
 }
예제 #3
0
 /**
  * Retrieve current layout object
  *
  * @return Mage_Core_Model_Layout
  */
 public function getLayout()
 {
     return $this->_layoutFactory->createLayout(array('area' => $this->_currentArea));
 }