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


PHP Session::setCookie方法代碼示例

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


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

示例1:

 function it_loads_base_url_and_sets_a_cookie_if_not_using_kernel_driver_and_driver_is_currently_outside_base_url(Session $minkSession, DriverInterface $driver)
 {
     $minkSession->getDriver()->willReturn($driver);
     $minkSession->getCurrentUrl()->willReturn('http://sylius.org');
     $minkSession->visit('http://localhost:8080/')->shouldBeCalled();
     $minkSession->setCookie('abc', 'def')->shouldBeCalled();
     $this->setCookie('abc', 'def');
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:8,代碼來源:CookieSetterSpec.php

示例2: logIn

 /**
  * {@inheritdoc}
  */
 public function logIn($email, $providerKey, Session $minkSession)
 {
     $user = $this->userRepository->findOneBy(['username' => $email]);
     if (null === $user) {
         throw new \InvalidArgumentException(sprintf('There is no user with email %s', $email));
     }
     $token = new UsernamePasswordToken($user, $user->getPassword(), $providerKey, $user->getRoles());
     $this->session->set('_security_user', serialize($token));
     $this->session->save();
     $minkSession->setCookie($this->session->getName(), $this->session->getId());
 }
開發者ID:Mangetsu,項目名稱:Sylius,代碼行數:14,代碼來源:SecurityService.php

示例3: array

 function it_does_not_log_user_in_if_user_was_not_found($userRepository, $session, UserInterface $user, Session $minkSession)
 {
     $userRoles = ['ROLE_USER'];
     $userRepository->findOneBy(array('username' => 'sylius@example.com'))->willReturn(null);
     $user->getRoles()->willReturn($userRoles);
     $user->getPassword()->willReturn('xyz');
     $user->serialize()->willReturn('serialized_user');
     $session->set('_security_user', Argument::any())->shouldNotBeCalled();
     $session->save()->shouldNotBeCalled();
     $session->getName()->willReturn('MOCKEDSID');
     $session->getId()->willReturn('xyzc123');
     $minkSession->setCookie('MOCKEDSID', 'xyzc123')->shouldNotBeCalled();
     $this->shouldThrow(new \InvalidArgumentException(sprintf('There is no user with email sylius@example.com')))->during('logIn', array('sylius@example.com', 'default', $minkSession));
 }
開發者ID:Spomky,項目名稱:Sylius,代碼行數:14,代碼來源:SecurityServiceSpec.php

示例4: testSetCookie

 public function testSetCookie()
 {
     $this->driver->expects($this->once())->method('setCookie')->with('name', 'value');
     $this->session->setCookie('name', 'value');
 }
開發者ID:saberyounis,項目名稱:Sonata-Project,代碼行數:5,代碼來源:SessionTest.php

示例5: _setCookie

 public function _setCookie($cookie, $value)
 {
     $this->session->setCookie($cookie, $value);
 }
開發者ID:lenninsanchez,項目名稱:donadores,代碼行數:4,代碼來源:Mink.php

示例6: setCookie

 /**
  * {@inheritdoc}
  */
 public function setCookie($name, $value)
 {
     $this->prepareMinkSessionIfNeeded();
     $this->minkSession->setCookie($name, $value);
 }
開發者ID:Mozan,項目名稱:Sylius,代碼行數:8,代碼來源:CookieSetter.php

示例7: iChangeMyCurrentChannelTo

 /**
  * @When I change my current channel to :channel
  */
 public function iChangeMyCurrentChannelTo(ChannelInterface $channel)
 {
     $this->prepareSessionIfNeeded();
     $this->minkSession->setCookie('_channel_code', $channel->getCode());
 }
開發者ID:Andretti23,項目名稱:Sylius,代碼行數:8,代碼來源:ChannelContext.php


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