Пример #1
0
 /**
  * Controller pre-dispatch method
  * Check if current section is found and is allowed
  *
  * @return Mage_Backend_Controller_ActionAbstract
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $section = null;
     if (!$this->getRequest()->getParam('section')) {
         $section = $this->_configStructure->getFirstSection();
         $this->getRequest()->setParam('section', $section->getId());
     } else {
         $this->_isSectionAllowed($this->getRequest()->getParam('section'));
     }
     return $this;
 }
Пример #2
0
 public function testGetFirstSectionReturnsFirstAllowedSection()
 {
     $tabMock = $this->getMock('Mage_Backend_Model_Config_Structure_Element_Tab', array('current', 'getChildren', 'rewind'), array(), '', false);
     $tabMock->expects($this->any())->method('getChildren')->will($this->returnSelf());
     $tabMock->expects($this->once())->method('rewind');
     $tabMock->expects($this->once())->method('current')->will($this->returnValue('currentSection'));
     $this->_tabIteratorMock->expects($this->once())->method('rewind');
     $this->_tabIteratorMock->expects($this->once())->method('current')->will($this->returnValue($tabMock));
     $this->assertEquals('currentSection', $this->_model->getFirstSection());
 }