本文整理匯總了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);
}