/** * Admin Session prolong functionality * * @param Session $session * @param \Closure $proceed * @return mixed */ public function aroundProlong(Session $session, \Closure $proceed) { if (!$this->sessionsManager->getCurrentSession()->isLoggedInStatus()) { $session->destroy(); $this->addUserLogoutNotification(); return null; } $result = $proceed(); $this->sessionsManager->processProlong(); return $result; }
/** * @return void */ public function testProcessProlong() { $sessionId = 50; $updatedAt = '2015-12-31 23:59:59'; $this->adminSessionInfoFactoryMock->expects($this->any())->method('create')->willReturn($this->currentSessionMock); $this->authSessionMock->expects($this->once())->method('getSessionId')->willReturn($sessionId); $this->currentSessionMock->expects($this->once())->method('load')->willReturnSelf(); $this->authSessionMock->expects($this->once())->method('getUpdatedAt')->willReturn($updatedAt); $this->currentSessionMock->expects($this->once())->method('setData')->with('updated_at', $updatedAt)->willReturnSelf(); $this->currentSessionMock->expects($this->once())->method('save')->willReturnSelf(); $this->model->processProlong(); }