コード例 #1
0
 public function testExecuteResultForward()
 {
     $this->forwardMock->expects($this->once())->method('setController')->with('index')->will($this->returnSelf());
     $this->forwardMock->expects($this->once())->method('forward')->with('defaultNoRoute')->will($this->returnSelf());
     $this->_cmsHelperMock->expects($this->once())->method('prepareResultPage')->will($this->returnValue(false));
     $this->assertSame($this->forwardMock, $this->_controller->execute());
 }
コード例 #2
0
 public function testExecuteWithoutWishlist()
 {
     $this->formKeyValidator->expects($this->once())->method('validate')->with($this->request)->will($this->returnValue(true));
     $this->wishlistProvider->expects($this->once())->method('getWishlist')->will($this->returnValue(null));
     $this->resultForwardMock->expects($this->once())->method('forward')->with('noroute')->willReturnSelf();
     $this->assertSame($this->resultForwardMock, $this->getController()->execute());
 }
コード例 #3
0
 public function testForwardWithParams()
 {
     $action = 'test_action';
     $params = ['param1', 'param2', 3];
     $controller = 'test_controller';
     $module = 'test_module';
     $this->forward->setModule($module);
     $this->forward->setParams($params);
     $this->forward->setController($controller);
     $this->requestInterface->expects($this->once())->method('setParams')->with($params);
     $this->requestInterface->expects($this->once())->method('setControllerName')->with($controller);
     $this->requestInterface->expects($this->once())->method('setModuleName')->with($module);
     $this->requestInterface->expects($this->once())->method('initForward');
     $this->requestInterface->expects($this->once())->method('setActionName')->with($action);
     $this->requestInterface->expects($this->once())->method('setDispatched');
     $this->assertInstanceOf('Magento\\Framework\\Controller\\Result\\Forward', $this->forward->forward($action));
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function renderResult(\Magento\Framework\App\ResponseInterface $response)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'renderResult');
     if (!$pluginInfo) {
         return parent::renderResult($response);
     } else {
         return $this->___callPlugins('renderResult', func_get_args(), $pluginInfo);
     }
 }
コード例 #5
0
ファイル: AllcartTest.php プロジェクト: nblair/magescotch
    public function testExecuteWithNoWishlist()
    {
        $this->wishlistProviderMock->expects($this->once())
            ->method('getWishlist')
            ->willReturn(false);
        $this->resultForwardMock->expects($this->once())
            ->method('forward')
            ->with('noroute')
            ->willReturnSelf();

        $this->assertSame($this->resultForwardMock, $this->allcartController->executeInternal());
    }
コード例 #6
0
 public function testExecuteBadSecretKey()
 {
     $this->itemOptionMock->expects($this->once())->method('load')->willReturnSelf();
     $this->itemOptionMock->expects($this->once())->method('getId')->willReturn(self::OPTION_ID);
     $this->itemOptionMock->expects($this->any())->method('getCode')->willReturn(self::OPTION_CODE);
     $this->itemOptionMock->expects($this->any())->method('getProductId')->willReturn(self::OPTION_PRODUCT_ID);
     $this->itemOptionMock->expects($this->any())->method('getValue')->willReturn(self::OPTION_VALUE);
     $this->productOptionMock->expects($this->once())->method('load')->willReturnSelf();
     $this->productOptionMock->expects($this->any())->method('getId')->willReturn(self::OPTION_ID);
     $this->productOptionMock->expects($this->any())->method('getProductId')->willReturn(self::OPTION_PRODUCT_ID);
     $this->productOptionMock->expects($this->any())->method('getType')->willReturn(self::OPTION_TYPE);
     $this->unserializeMock->expects($this->once())->method('unserialize')->with(self::OPTION_VALUE)->willReturn([self::SECRET_KEY => 'bad_test_secret_key']);
     $this->resultForwardMock->expects($this->once())->method('forward')->with('noroute')->willReturn(true);
     $this->objectMock->execute();
 }
コード例 #7
0
 public function testExecuteResultForward()
 {
     $this->requestMock->expects($this->atLeastOnce())->method('getParam')->willReturnMap([['page_id', $this->pageId, $this->pageId], ['id', false, $this->pageId]]);
     $this->forwardMock->expects($this->once())->method('forward')->with('noroute')->willReturnSelf();
     $this->assertSame($this->forwardMock, $this->controller->execute());
 }
コード例 #8
0
ファイル: IndexTest.php プロジェクト: nblair/magescotch
 public function testExecuteResultForward()
 {
     $this->forwardMock->expects($this->once())->method('forward')->with('defaultIndex')->willReturnSelf();
     $this->assertSame($this->forwardMock, $this->controller->executeInternal());
 }
コード例 #9
0
ファイル: Forward.php プロジェクト: pradeep-wagento/magento2
 /**
  * @param string $action
  * @return $this
  */
 public function forward($action)
 {
     $this->session->setIsUrlNotice($this->actionFlag->get('', AbstractAction::FLAG_IS_URLS_CHECKED));
     return parent::forward($action);
 }