Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DefaultRouterTest.php
Go to the documentation of this file.
1 <?php
9 
10 class DefaultRouterTest extends \PHPUnit\Framework\TestCase
11 {
15  protected $_model;
16 
17  public function testMatch()
18  {
19  $request = $this->createMock(\Magento\Framework\App\RequestInterface::class);
20  $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
21  $actionFactory = $this->createMock(\Magento\Framework\App\ActionFactory::class);
22  $actionFactory->expects($this->once())->method('create')->with(
23  \Magento\Framework\App\Action\Forward::class
24  )->will(
25  $this->returnValue(
26  $this->getMockForAbstractClass(\Magento\Framework\App\Action\AbstractAction::class, [], '', false)
27  )
28  );
29  $noRouteHandler = $this->createMock(\Magento\Framework\App\Router\NoRouteHandler::class);
30  $noRouteHandler->expects($this->any())->method('process')->will($this->returnValue(true));
31  $noRouteHandlerList = $this->createMock(\Magento\Framework\App\Router\NoRouteHandlerList::class);
32  $noRouteHandlerList->expects($this->any())->method('getHandlers')->will($this->returnValue([$noRouteHandler]));
33  $this->_model = $helper->getObject(
34  \Magento\Framework\App\Router\DefaultRouter::class,
35  [
36  'actionFactory' => $actionFactory,
37  'noRouteHandlerList' => $noRouteHandlerList
38  ]
39  );
40  $this->assertInstanceOf(\Magento\Framework\App\Action\AbstractAction::class, $this->_model->match($request));
41  }
42 }
$helper
Definition: iframe.phtml:13