本文整理汇总了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();
}
示例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();
}
示例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;
}