本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\Session::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::getName方法的具体用法?PHP Session::getName怎么用?PHP Session::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\Session
的用法示例。
在下文中一共展示了Session::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_do_not_authenticate_channel_when_cookie_name_is_missing
public function it_do_not_authenticate_channel_when_cookie_name_is_missing(Session $session, ParameterBag $cookies)
{
$session->getName()->shouldBeCalled()->willReturn('session');
$cookies->get('session')->shouldBeCalled()->willReturn('invalid_channel');
$session->set('socketId', 1)->shouldNotBeCalled();
$session->set('channelName', 'new_channel')->shouldNotBeCalled();
$this->authenticate(1, 'new_channel')->shouldReturn(false);
}
示例2: iAmAnLoggedInAs
/**
* @Given I am logged in as :username
*/
public function iAmAnLoggedInAs($username)
{
$session = new Session();
$client = $this->getSession()->getDriver()->getClient();
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
$session = $this->getContainer()->get('session');
$user = $this->getKernel()->getContainer()->get('oauth2_server.test_bundle.end_user_manager')->getEndUserByUsername($username);
if (null === $user) {
throw new \Exception('Unknown user');
}
$token = new UsernamePasswordToken($user, 'secret', 'main', $user->getRoles());
$session->set('_security_main', serialize($token));
$session->save();
$cookie = new Cookie($session->getName(), $session->getId());
$client->getCookieJar()->set($cookie);
}