本文整理汇总了PHP中HttpResponse::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpResponse::toString方法的具体用法?PHP HttpResponse::toString怎么用?PHP HttpResponse::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpResponse
的用法示例。
在下文中一共展示了HttpResponse::toString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGeneral
function testGeneral()
{
$str = <<<EOF
HTTP/1.1 500 Server error
Host: localhost:8080
X-Powered-By: PHP/5.4.31
bc-param1: hello, world
Content-Type: text/plain
Exception: exception 'PDOException'
EOF;
$res = new HttpResponse($str);
$this->assertEquals(500, $res->code);
$this->assertEquals("Server error", $res->message);
$this->assertEquals("localhost:8080", $res->headers["HOST"]);
$this->assertEquals("Exception: exception 'PDOException'", $res->body);
$this->assertEquals("hello, world", $res->getHeader("bc-param1"));
$this->assertEquals("hello, world", $res->getBCParam("param1"));
$this->assertNull($res->getHeader("bc-param2"));
$this->assertNull($res->getBCParam("param2"));
$this->assertEquals($str, $res->toString());
}