Пример #1
0
 /**
  * Modify request and set to no-route action
  *
  * @param RequestInterface $request
  * @return boolean
  */
 public function match(RequestInterface $request)
 {
     foreach ($this->noRouteHandlerList->getHandlers() as $noRouteHandler) {
         if ($noRouteHandler->process($request)) {
             break;
         }
     }
     return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward');
 }
 public function testGetHandlers()
 {
     $backendHandlerMock = $this->getMock('Magento\\Backend\\App\\Router\\NoRouteHandler', [], [], '', false);
     $defaultHandlerMock = $this->getMock('Magento\\Framework\\App\\Router\\NoRouteHandler', [], [], '', false);
     $this->_objectManagerMock->expects($this->at(0))->method('create')->with('Magento\\Backend\\App\\Router\\NoRouteHandler')->will($this->returnValue($backendHandlerMock));
     $this->_objectManagerMock->expects($this->at(1))->method('create')->with('Magento\\Framework\\App\\Router\\NoRouteHandler')->will($this->returnValue($defaultHandlerMock));
     $expectedResult = ['0' => $backendHandlerMock, '1' => $defaultHandlerMock];
     $this->assertEquals($expectedResult, $this->_model->getHandlers());
 }