本文整理汇总了PHP中Behat\Mink\Session::getResponseHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::getResponseHeaders方法的具体用法?PHP Session::getResponseHeaders怎么用?PHP Session::getResponseHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behat\Mink\Session
的用法示例。
在下文中一共展示了Session::getResponseHeaders方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseCookieFromHeaders
/**
*
* this method fixes the following
*
* @see \Behat\Mink\Driver\BrowserKitDriver::getCookie
* Note that the following doesn't work well because
* Symfony\Component\BrowserKit\CookieJar stores cookies by name,
* path, AND domain and if you don't fill them all in correctly then
* you won't get the value that you're expecting.
*
*
*
* @param string $name
* @return null|string
*/
private function parseCookieFromHeaders($name)
{
try {
$headers = $this->session->getResponseHeaders();
} catch (\Behat\Mink\Exception\UnsupportedDriverActionException $e) {
return null;
}
if (!is_array($headers) || empty($headers) || !isset($headers['set-cookie'])) {
return null;
}
foreach ($headers['set-cookie'] as $cookieString) {
if (!(stripos($cookieString, $name . '=') === 0)) {
continue;
}
$cookiePieces = explode(';', $cookieString);
if (!$cookiePieces) {
return null;
}
$cookieKeyValue = explode('=', $cookiePieces[0]);
if (!isset($cookieKeyValue[1])) {
return null;
}
return $cookieKeyValue[1];
}
return null;
}
示例2: _getResponseHeader
public function _getResponseHeader($header)
{
$headers = $this->session->getResponseHeaders();
if (!isset($headers[$header])) {
return false;
}
return $headers[$header];
}
示例3: testGetResponseHeaders
public function testGetResponseHeaders()
{
$this->driver->expects($this->once())->method('getResponseHeaders')->will($this->returnValue($ret = array(2, 3, 4)));
$this->assertEquals($ret, $this->session->getResponseHeaders());
}
示例4: getResponseHeadersLogMessage
/**
* @param Session $session
*
* @return string|null
*/
private function getResponseHeadersLogMessage(Session $session)
{
try {
return 'Response headers:' . "\n" . print_r($session->getResponseHeaders(), true) . "\n";
} catch (MinkException $exception) {
return null;
}
}