Ejemplo n.º 1
0
 /**
  * @return void
  */
 public function testAroundProlongSessionIsNotActiveAndIsAjaxRequest()
 {
     $result = 'result';
     $status = 1;
     $proceed = function () use($result) {
         return $result;
     };
     $this->currentSessionMock->expects($this->any())->method('isActive')->willReturn(false);
     $this->authSessionMock->expects($this->once())->method('destroy');
     $this->requestMock->expects($this->once())->method('getParam')->with('isAjax')->willReturn(true);
     $this->currentSessionMock->expects($this->once())->method('getStatus')->willReturn($status);
     $this->securityCookieMock->expects($this->once())->method('setLogoutReasonCookie')->with($status)->willReturnSelf();
     $this->model->aroundProlong($this->authSessionMock, $proceed);
 }
Ejemplo n.º 2
0
 /**
  * @return void
  */
 public function testBeforeExecute()
 {
     $logoutReasonCode = 2;
     $uri = '/uri/';
     $errorMessage = 'Error Message';
     $this->securityCookieMock->expects($this->once())->method('getLogoutReasonCookie')->willReturn($logoutReasonCode);
     $this->backendControllerAuthLoginMock->expects($this->once())->method('getRequest')->willReturn($this->requestMock);
     $this->requestMock->expects($this->once())->method('getUri')->willReturn($uri);
     $this->backendControllerAuthLoginMock->expects($this->once())->method('getUrl')->willReturn($uri);
     $this->adminSessionsManagerMock->expects($this->once())->method('getLogoutReasonMessageByStatus')->with($logoutReasonCode)->willReturn($errorMessage);
     $this->messageManagerMock->expects($this->once())->method('addError')->with($errorMessage);
     $this->securityCookieMock->expects($this->once())->method('deleteLogoutReasonCookie')->willReturnSelf();
     $this->controller->beforeExecute($this->backendControllerAuthLoginMock);
 }