예제 #1
0
 /**
  * Check if current section is found and is allowed
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$request->getParam('section')) {
         $request->setParam('section', $this->_configStructure->getFirstSection()->getId());
     }
     return parent::dispatch($request);
 }
예제 #2
0
 /**
  * Check if current section is found and is allowed
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $section = null;
     if (!$request->getParam('section')) {
         $section = $this->_configStructure->getFirstSection();
         $request->setParam('section', $section->getId());
     } else {
         $this->_isSectionAllowed($request->getParam('section'));
     }
     return parent::dispatch($request);
 }
예제 #3
0
 public function testGetFirstSectionReturnsFirstAllowedSection()
 {
     $tabMock = $this->getMock('Magento\\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());
 }