public function testExecuteWithoutFormKey() { /** @var \Magento\Framework\Controller\Result\Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */ $redirectMock = $this->getMockBuilder('Magento\Framework\Controller\Result\Redirect') ->disableOriginalConstructor() ->getMock(); $this->resultFactoryMock->expects($this->once()) ->method('create') ->willReturnMap( [ [\Magento\Framework\Controller\ResultFactory::TYPE_REDIRECT, [], $redirectMock], ] ); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->requestMock) ->willReturn(false); $redirectMock->expects($this->once()) ->method('setPath') ->with('sendfriend/product/send', ['_current' => true]) ->willReturnSelf(); $this->assertEquals($redirectMock, $this->model->executeInternal()); }
/** * {@inheritdoc} */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch'); if (!$pluginInfo) { return parent::dispatch($request); } else { return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo); } }