当前位置: 首页>>代码示例>>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;未经允许,请勿转载。