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


PHP Client::setServerParameters方法代碼示例

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


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

 protected function resetVariables()
 {
     $this->headers = array();
     $this->params = array();
     $this->response = "";
     if ($this->client) {
         $this->client->setServerParameters(array());
     }
 }
開發者ID:Eli-TW,項目名稱:Codeception,代碼行數:9,代碼來源:REST.php

示例3: resetVariables

 protected function resetVariables()
 {
     $this->params = [];
     $this->response = "";
     $this->connectionModule->headers = [];
     if ($this->client) {
         $this->client->setServerParameters([]);
     }
 }
開發者ID:janhenkgerritsen,項目名稱:Codeception,代碼行數:9,代碼來源:REST.php

示例4: _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

示例5: testOverrideSessionParams

 /** @dataProvider provideOverrideSessionParams */
 public function testOverrideSessionParams($expectedDomain, $expectedPath, $expectedSecure, $expectedHttponly, $expectedExpire, $config)
 {
     $app = new CallableHttpKernel(function (Request $request) {
         $request->getSession()->set('some_session_var', 'is set');
         return new Response('test');
     });
     $app = $this->sessionify($app, $config);
     $client = new Client($app);
     $client->setServerParameters(array('REQUEST_TIME' => static::SIMULATED_TIME));
     $client->request('GET', '/');
     $this->assertEquals('test', $client->getResponse()->getContent());
     $cookies = $client->getResponse()->headers->getCookies();
     $this->assertCount(1, $cookies);
     $cookie = $cookies[0];
     $expectedCookie = new Cookie($this->mockFileSessionStorage->getName(), $this->mockFileSessionStorage->getId(), $expectedExpire, $expectedPath, $expectedDomain, $expectedSecure, $expectedHttponly);
     $this->assertEquals($expectedCookie, $cookie);
     $bag = $this->mockFileSessionStorage->getBag('attributes');
     $this->assertEquals('is set', $bag->get('some_session_var'));
 }
開發者ID:pwhelan,項目名稱:session,代碼行數:20,代碼來源:SessionTest.php


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