本文整理汇总了PHP中Symfony\Component\HttpKernel\Client::getClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getClient方法的具体用法?PHP Client::getClient怎么用?PHP Client::getClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\Client
的用法示例。
在下文中一共展示了Client::getClient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 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);
}
}