public function testExecute() { $customerId = 1; $refererUrl = 'http://referer.url'; $this->sessionMock->expects($this->once())->method('getId')->willReturn($customerId); $this->sessionMock->expects($this->once())->method('logout')->willReturnSelf(); $this->redirect->expects($this->once())->method('getRefererUrl')->willReturn($refererUrl); $this->sessionMock->expects($this->once())->method('setBeforeAuthUrl')->with($refererUrl)->willReturnSelf(); $this->sessionMock->expects($this->once())->method('setLastCustomerId')->with($customerId); $this->cookieManager->expects($this->once())->method('getCookie')->with('mage-cache-sessid')->willReturn(true); $this->cookieMetadataFactory->expects($this->once())->method('createCookieMetadata')->willReturn($this->cookieMetadata); $this->cookieMetadata->expects($this->once())->method('setPath')->with('/'); $this->cookieManager->expects($this->once())->method('deleteCookie')->with('mage-cache-sessid', $this->cookieMetadata); $this->redirectFactory->expects($this->once())->method('create')->willReturn($this->resultRedirect); $this->resultRedirect->expects($this->once())->method('setPath')->with('*/*/logoutSuccess'); $this->assertSame($this->resultRedirect, $this->controller->execute()); }
/** * {@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); } }