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


PHP SessionManagerInterface::start方法代碼示例

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


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

示例1: testIsValidForHost

 public function testIsValidForHost()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $this->_model->start('test');
     $reflection = new \ReflectionMethod($this->_model, '_addHost');
     $reflection->setAccessible(true);
     $reflection->invoke($this->_model);
     $this->assertFalse($this->_model->isValidForHost('test.com'));
     $this->assertTrue($this->_model->isValidForHost('localhost'));
     $this->_model->destroy();
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:11,代碼來源:SessionManagerTest.php

示例2: testStartAreaNotSet

 /**
  * @expectedException \Magento\Framework\Exception\SessionException
  * @expectedExceptionMessage Area code not set: Area code must be set before starting a session.
  */
 public function testStartAreaNotSet()
 {
     $scope = $this->objectManager->get('Magento\\Framework\\Config\\ScopeInterface');
     $appState = new \Magento\Framework\App\State($scope);
     /**
      * Must be created by "new" in order to get a real Magento\Framework\App\State object that
      * is not overridden in the TestFramework
      *
      * @var \Magento\Framework\Session\SessionManager _model
      */
     $this->_model = new \Magento\Framework\Session\SessionManager($this->objectManager->get('Magento\\Framework\\App\\Request\\Http'), $this->_sidResolver, $this->objectManager->get('Magento\\Framework\\Session\\Config\\ConfigInterface'), $this->objectManager->get('Magento\\Framework\\Session\\SaveHandlerInterface'), $this->objectManager->get('Magento\\Framework\\Session\\ValidatorInterface'), $this->objectManager->get('Magento\\Framework\\Session\\StorageInterface'), $this->objectManager->get('Magento\\Framework\\Stdlib\\CookieManagerInterface'), $this->objectManager->get('Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory'), $appState);
     global $mockPHPFunctions;
     $mockPHPFunctions = true;
     $this->_model->start();
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:19,代碼來源:SessionManagerTest.php

示例3: _getSession

 /**
  * Retrieve store session object
  *
  * @return \Magento\Framework\Session\SessionManagerInterface
  */
 protected function _getSession()
 {
     if (!$this->_session->isSessionExists()) {
         $this->_session->setName('store_' . $this->getCode());
         $this->_session->start();
     }
     return $this->_session;
 }
開發者ID:mrbadao,項目名稱:magento-ce,代碼行數:13,代碼來源:Store.php


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