當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::prolong方法代碼示例

本文整理匯總了PHP中Magento\Backend\Model\Auth\Session::prolong方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::prolong方法的具體用法?PHP Session::prolong怎麽用?PHP Session::prolong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Backend\Model\Auth\Session的用法示例。


在下文中一共展示了Session::prolong方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testProcessProlong

 /**
  * 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);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:18,代碼來源:AuthSessionTest.php

示例2: prolong

 /**
  * {@inheritdoc}
  */
 public function prolong()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'prolong');
     if (!$pluginInfo) {
         return parent::prolong();
     } else {
         return $this->___callPlugins('prolong', func_get_args(), $pluginInfo);
     }
 }
開發者ID:dragonsword007008,項目名稱:magento2,代碼行數:12,代碼來源:Interceptor.php

示例3: testProlong

 public function testProlong()
 {
     $name = session_name();
     $cookie = 'cookie';
     $lifetime = 900;
     $path = '/';
     $domain = 'magento2';
     $secure = true;
     $httpOnly = true;
     $this->cookie->expects($this->once())->method('get')->with($name)->will($this->returnValue($cookie));
     $this->cookie->expects($this->once())->method('set')->with($name, $cookie, $lifetime, $path, $domain, $secure, $httpOnly);
     $this->config->expects($this->once())->method('getValue')->with(\Magento\Backend\Model\Auth\Session::XML_PATH_SESSION_LIFETIME)->will($this->returnValue($lifetime));
     $this->sessionConfig->expects($this->once())->method('getCookiePath')->will($this->returnValue($path));
     $this->sessionConfig->expects($this->once())->method('getCookieDomain')->will($this->returnValue($domain));
     $this->sessionConfig->expects($this->once())->method('getCookieSecure')->will($this->returnValue($secure));
     $this->sessionConfig->expects($this->once())->method('getCookieHttpOnly')->will($this->returnValue($httpOnly));
     $this->session->prolong();
     $this->assertLessThanOrEqual(time(), $this->session->getUpdatedAt());
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:19,代碼來源:SessionTest.php


注:本文中的Magento\Backend\Model\Auth\Session::prolong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。