/** * Test of prolong user action * * @magentoDbIsolation enabled */ public function testProcessProlong() { $this->auth->login(\Magento\TestFramework\Bootstrap::ADMIN_NAME, \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD); $sessionId = $this->authSession->getSessionId(); $dateInPast = $this->dateTime->formatDate($this->authSession->getUpdatedAt() - 100); $this->adminSessionsManager->getCurrentSession()->setData('updated_at', $dateInPast)->save(); $this->adminSessionInfo->load($sessionId, 'session_id'); $oldUpdatedAt = $this->adminSessionInfo->getUpdatedAt(); $this->authSession->prolong(); $this->adminSessionInfo->load($sessionId, 'session_id'); $updatedAt = $this->adminSessionInfo->getUpdatedAt(); $this->assertGreaterThan($oldUpdatedAt, $updatedAt); }
/** * Test if current session is retrieved * * @magentoDbIsolation enabled */ public function testGetCurrentSession() { $this->auth->login(\Magento\TestFramework\Bootstrap::ADMIN_NAME, \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD); $sessionId = $this->authSession->getSessionId(); $this->adminSessionInfo->load($sessionId, 'session_id'); $this->assertEquals($this->adminSessionInfo->getSessionId(), $this->adminSessionsManager->getCurrentSession()->getSessionId()); }
/** * Get current session record * * @return AdminSessionInfo */ public function getCurrentSession() { if (!$this->currentSession) { $this->currentSession = $this->adminSessionInfoFactory->create(); $this->currentSession->load($this->authSession->getSessionId(), 'session_id'); } return $this->currentSession; }