Ejemplo n.º 1
0
 /**
  * @magentoAppArea frontend
  */
 public function testMatch()
 {
     if (!\Magento\TestFramework\Helper\Bootstrap::canTestHeaders()) {
         $this->markTestSkipped('Can\'t test get match without sending headers');
     }
     /** @var $objectManager \Magento\TestFramework\ObjectManager */
     $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     /** @var $request \Magento\TestFramework\Request */
     $request = $objectManager->get('Magento\\TestFramework\\Request');
     $this->assertInstanceOf('Magento\\Framework\\App\\ActionInterface', $this->_model->match($request));
     $request->setRequestUri('framework/index/index');
     $this->assertInstanceOf('Magento\\Framework\\App\\ActionInterface', $this->_model->match($request));
     $request->setPathInfo('not_exists/not_exists/not_exists')->setModuleName('not_exists')->setControllerName('not_exists')->setActionName('not_exists');
     $this->assertNull($this->_model->match($request));
 }
Ejemplo n.º 2
0
 public function testMatchEmptyActionInstance()
 {
     // Test Data
     $nullActionInstance = null;
     $moduleFrontName = 'module front name';
     $actionPath = 'action path';
     $actionName = 'action name';
     $actionClassName = 'Magento\\Cms\\Controller\\Index\\Index';
     $moduleName = 'module name';
     $moduleList = [$moduleName];
     // Stubs
     $this->requestMock->expects($this->any())->method('getModuleName')->willReturn($moduleFrontName);
     $this->routeConfigMock->expects($this->any())->method('getModulesByFrontName')->willReturn($moduleList);
     $this->requestMock->expects($this->any())->method('getControllerName')->willReturn($actionPath);
     $this->requestMock->expects($this->any())->method('getActionName')->willReturn($actionName);
     $this->appStateMock->expects($this->any())->method('isInstalled')->willReturn(false);
     $this->actionListMock->expects($this->any())->method('get')->willReturn($actionClassName);
     $this->actionFactoryMock->expects($this->any())->method('create')->willReturn($nullActionInstance);
     // Expectations and Test
     $this->assertNull($this->model->match($this->requestMock));
 }