当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::getCookieJar方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpKernel\Client::getCookieJar方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getCookieJar方法的具体用法?PHP Client::getCookieJar怎么用?PHP Client::getCookieJar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpKernel\Client的用法示例。


在下文中一共展示了Client::getCookieJar方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _before

 public function _before(\Codeception\TestCase $test)
 {
     if (!$this->client) {
         if (!strpos($this->config['url'], '://')) {
             // not valid url
             foreach ($this->getModules() as $module) {
                 if ($module instanceof \Codeception\Lib\Framework) {
                     $this->client = $module->client;
                     $this->isFunctional = true;
                     break;
                 }
             }
         } else {
             if (!$this->hasModule('PhpBrowser')) {
                 throw new ModuleConfigException(__CLASS__, "For REST testing via HTTP please enable PhpBrowser module");
             }
             $this->client = $this->getModule('PhpBrowser')->client;
         }
         if (!$this->client) {
             throw new ModuleConfigException(__CLASS__, "Client for REST requests not initialized.\nProvide either PhpBrowser module, or a framework module which shares FrameworkInterface");
         }
     }
     $this->headers = array();
     $this->params = array();
     $this->response = "";
     $this->client->setServerParameters(array());
     if ($this->config['xdebug_remote'] && function_exists('xdebug_is_enabled') && xdebug_is_enabled() && ini_get('xdebug.remote_enable') && !$this->isFunctional) {
         $cookie = new Cookie('XDEBUG_SESSION', $this->config['xdebug_remote'], null, '/');
         $this->client->getCookieJar()->set($cookie);
     }
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:31,代码来源:REST.php

示例2: _before

 public function _before(\Codeception\TestCase $test)
 {
     $this->client =& $this->connectionModule->client;
     $this->resetVariables();
     if ($this->config['xdebug_remote'] && function_exists('xdebug_is_enabled') && ini_get('xdebug.remote_enable') && !$this->isFunctional) {
         $cookie = new Cookie('XDEBUG_SESSION', $this->config['xdebug_remote'], null, '/');
         $this->client->getCookieJar()->set($cookie);
     }
 }
开发者ID:namnv609,项目名称:Codeception,代码行数:9,代码来源:REST.php

示例3: testGetSessionDataIncorrectSessionData

 /**
  * @dataProvider provideIncorrectValues
  * @expectedException RuntimeException
  */
 public function testGetSessionDataIncorrectSessionData($value)
 {
     $cookie = new Cookie('TEST', $value);
     $client = new Client(new Application());
     $client->getCookieJar()->set($cookie);
     $this->getSessionData($client, 'TEST');
 }
开发者ID:renegare,项目名称:silexcsh,代码行数:11,代码来源:CookieSessionTestTraitTest.php

示例4: getAccessToken

 public function getAccessToken(Client $client)
 {
     $app = $this->app;
     $this->assertArrayHasKey('session.storage.handler', $app, 'Renegare\\SilexCSH\\CookieSessionServiceProvider has not been registered.');
     $sessionStorageHandler = $app['session.storage.handler'];
     $this->assertInstanceOf('Renegare\\SilexCSH\\CookieSessionHandler', $sessionStorageHandler, 'Can only support Renegare\\SilexCSH\\CookieSessionHandler sessions');
     $cookie = $client->getCookieJar()->get($sessionStorageHandler->getCookieName());
     $sessionData = unserialize(unserialize($cookie->getValue())[1]);
     $token = unserialize($sessionData['_security_app']);
     return $token;
 }
开发者ID:renegare,项目名称:weblet-client,代码行数:11,代码来源:WebletTestCase.php

示例5: _before

 public function _before(\Codeception\TestCase $test)
 {
     if (!$this->client) {
         if (!strpos($this->config['url'], '://')) {
             // not valid url
             foreach ($this->getModules() as $module) {
                 if ($module instanceof \Codeception\Util\Framework) {
                     $this->client = $module->client;
                     $this->is_functional = true;
                     break;
                 }
             }
         } else {
             if (!$this->hasModule('PhpBrowser')) {
                 throw new ModuleConfigException(__CLASS__, "For REST testing via HTTP please enable PhpBrowser module");
             }
             $this->client = $this->getModule('PhpBrowser')->session->getDriver()->getClient();
         }
         if (!$this->client) {
             throw new ModuleConfigException(__CLASS__, "Client for REST requests not initialized.\nProvide either PhpBrowser module, or a framework module which shares FrameworkInterface");
         }
     }
     $this->headers = array();
     $this->params = array();
     $this->response = "";
     $this->client->setServerParameters(array());
     $timeout = $this->config['timeout'];
     if ($this->config['xdebug_remote'] && function_exists('xdebug_is_enabled') && xdebug_is_enabled() && ini_get('xdebug.remote_enable')) {
         $cookie = new Cookie('XDEBUG_SESSION', $this->config['xdebug_remote'], null, '/');
         $this->client->getCookieJar()->set($cookie);
         // timeout is disabled, so we can debug gently :)
         $timeout = 0;
     }
     if (method_exists($this->client, 'getClient')) {
         $clientConfig = $this->client->getClient()->getConfig();
         $curlOptions = $clientConfig->get('curl.options');
         $curlOptions[CURLOPT_TIMEOUT] = $timeout;
         $clientConfig->set('curl.options', $curlOptions);
     }
 }
开发者ID:pfz,项目名称:codeception,代码行数:40,代码来源:REST.php

示例6: createSessionCookie

 /**
  * save cookie session data to a client
  * @param Client $client - client containing the cookie data
  * @param Application|string $app - if Application we retrieve the cookie name from the 'session.cookie.options' configuration else we assume this is the name of the cookie
  * @param array $data - session data
  * @throws RuntimeException - when something is amiss, please read the exception message
  * @return array
  */
 public function createSessionCookie(Client $client, $app, array $data)
 {
     $cookie = new Cookie($this->getCookieSessionName($app), serialize([0, serialize($data)]));
     $client->getCookieJar()->set($cookie);
     return $cookie;
 }
开发者ID:renegare,项目名称:silexcsh,代码行数:14,代码来源:CookieSessionTestTrait.php

示例7: authorize

 protected function authorize()
 {
     $cookieName = $this->app['amazon_s3_credentials_cookie_name'];
     $this->client->getCookieJar()->set(new Cookie($cookieName, json_encode(['key' => 'foo', 'secret' => 'bar'])));
 }
开发者ID:ossinkine,项目名称:amazon-s3-client,代码行数:5,代码来源:ApplicationTest.php


注:本文中的Symfony\Component\HttpKernel\Client::getCookieJar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。