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


PHP Client::setServerParameters方法代码示例

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


在下文中一共展示了Client::setServerParameters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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\Util\Framework) {
                     $this->client = $module->client;
                     $this->is_functional = true;
                     break;
                 }
             }
         } else {
             if (!$this->hasModule('PhpBrowser')) {
                 throw new ModuleConfigException(__CLASS__, "For XMLRPC testing via HTTP please enable PhpBrowser module");
             }
             $this->client = $this->getModule('PhpBrowser')->session->getDriver()->getClient();
         }
         if (!$this->client) {
             throw new ModuleConfigException(__CLASS__, "Client for XMLRPC 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());
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:27,代码来源:XMLRPC.php

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

示例3: 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

示例4: testIndex

 public function testIndex()
 {
     $this->client = static::createClient();
     $this->client->setServerParameters(['CONTENT_TYPE' => 'application/json', 'HTTP_HOST' => 'localhost:8000']);
     // create user
     $userName = md5(microtime());
     $registration = $this->makeRequest('/user/create', ["user" => ["name" => $userName]]);
     $this->assertEquals($registration->getMessage(), 'Ok');
     $userId = $registration->getData()->id;
     // try to create duplicate
     $registration = $this->makeRequest('/user/create', ["user" => ["name" => $userName]]);
     $this->assertEquals($registration->getMessage(), 'User already exists');
     // create opponents
     for ($i = 0; $i <= 10; $i++) {
         $registration = $this->makeRequest('/user/create', ["user" => ["name" => md5(microtime() + $i)]]);
         $this->assertEquals($registration->getMessage(), 'Ok');
     }
     // login
     $login = $this->makeRequest('/user/login', ["token" => $userName]);
     $this->assertEquals($login->getMessage(), 'Ok');
     $this->assertEquals($login->getData()->id, $userId);
     // opponent
     $opponents = $this->makeRequest('/user/opponents', ["token" => $userName]);
     $this->assertEquals($opponents->getMessage(), 'Ok');
     $opponentId = $opponents->getData()[0]->id;
     $opponentName = $opponents->getData()[0]->name;
     // invite
     $response = $this->makeRequest('/combat/invite', ["token" => $userName, "id" => $opponentId]);
     $this->assertEquals($response->getMessage(), 'Ok');
     $combatId = $response->getData()->combatId;
     $attackFirst = $response->getData()->youFirst;
     // attack
     $response = $this->makeRequest('/combat/attack', ["token" => $attackFirst ? $opponentName : $userName, "combatId" => $combatId, "skillId" => 2]);
     $this->assertEquals($response->getMessage(), 'It is not your turn');
     // attack
     $response = $this->makeRequest('/combat/attack', ["token" => $attackFirst ? $userName : $opponentName, "combatId" => $combatId, "skillId" => 2]);
     $this->assertEquals($response->getMessage(), 'Ok');
     // attack
     $response = $this->makeRequest('/combat/attack', ["token" => $attackFirst ? $opponentName : $userName, "combatId" => $combatId, "skillId" => 2]);
     $this->assertEquals($response->getMessage(), 'This skill already used');
     // collect
     $response = $this->makeRequest('/combat/collect', ["token" => $attackFirst ? $opponentName : $userName, "combatId" => $combatId]);
     $this->assertEquals($response->getMessage(), 'Combat is not finished');
     // attack
     $response = $this->makeRequest('/combat/attack', ["token" => $attackFirst ? $opponentName : $userName, "combatId" => $combatId, "skillId" => 1]);
     $this->assertEquals($response->getMessage(), 'Ok');
     // attack
     $response = $this->makeRequest('/combat/attack', ["token" => $attackFirst ? $userName : $opponentName, "combatId" => $combatId, "skillId" => 3]);
     $this->assertEquals($response->getMessage(), 'Ok');
     // attack
     $response = $this->makeRequest('/combat/attack', ["token" => $attackFirst ? $opponentName : $userName, "combatId" => $combatId, "skillId" => 1]);
     $this->assertEquals($response->getMessage(), 'Combat was finished');
     // collect
     $response = $this->makeRequest('/combat/collect', ["token" => $opponentName, "combatId" => $combatId]);
     // collect
     $response = $this->makeRequest('/combat/collect', ["token" => $userName, "combatId" => $combatId]);
 }
开发者ID:jced-artem,项目名称:test_game,代码行数:57,代码来源:UserControllerTest.php

示例5: resetVariables

 protected function resetVariables()
 {
     $this->params = [];
     $this->response = "";
     $this->connectionModule->headers = [];
     if ($this->client) {
         $this->client->setServerParameters([]);
     }
 }
开发者ID:janhenkgerritsen,项目名称:Codeception,代码行数:9,代码来源:REST.php

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


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