本文整理汇总了PHP中Guzzle\Http\Message\Response::isError方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::isError方法的具体用法?PHP Response::isError怎么用?PHP Response::isError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Http\Message\Response
的用法示例。
在下文中一共展示了Response::isError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkForHttpError
/**
* @param Response $response
* @param asserter\generator $asserter
* @param string $expectedResponseContentType application/json|application/xml
*/
private function checkForHttpError(Response $response, asserter\generator $asserter, $expectedResponseContentType)
{
if ($response->isError() || $this->isHttpErrorFatal($response, $expectedResponseContentType)) {
$asserter->boolean(true)->isTrue('Benchmarking encountered a Fatal Error');
}
}
示例2: isError
/**
* {@inheritdoc}
*/
public function isError()
{
return $this->response->isError();
}
示例3: testIsError
/**
* @covers Guzzle\Http\Message\Response::isError
*/
public function testIsError()
{
$response = new Response(403);
$this->assertTrue($response->isError());
$response = new Response(200);
$this->assertFalse($response->isError());
$response = new Response(500);
$this->assertTrue($response->isError());
}
示例4: getHttpClientMock
/**
*
* @param \Guzzle\Http\Message\Response $response
* @return \Guzzle\Http\Client
*/
protected function getHttpClientMock(Response $response)
{
$client = $this->getMockBuilder('\\Guzzle\\Http\\Client')->setMethods(array('send'))->getMock();
if ($response->isError()) {
$request = $this->getMockBuilder('\\Guzzle\\Http\\Message\\Request')->disableOriginalConstructor()->getMock();
$e = BadResponseException::factory($request, $response);
$client->expects($this->any())->method('send')->will($this->throwException($e));
} else {
$client->expects($this->any())->method('send')->will($this->returnValue($response));
}
return $client;
}