本文整理汇总了PHP中Symfony\Component\HttpFoundation\Response::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::__toString方法的具体用法?PHP Response::__toString怎么用?PHP Response::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Response
的用法示例。
在下文中一共展示了Response::__toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
public function __toString()
{
$this->headers->set('Content-Length', strlen($this->getContent()));
return parent::__toString();
}
示例2: testDefaultContentType
public function testDefaultContentType()
{
$headerMock = $this->getMock('Symfony\\Component\\HttpFoundation\\ResponseHeaderBag', array('set'));
$headerMock->expects($this->at(0))->method('set')->with('Content-Type', 'text/html; charset=UTF-8');
$headerMock->expects($this->at(1))->method('set')->with('Content-Type', 'text/html; charset=Foo');
$response = new Response();
$response->headers = $headerMock;
// verify first set()
$response->__toString();
$response->headers->remove('Content-Type');
$response->setCharset('Foo');
// verify second set()
$response->__toString();
}
示例3: testContentTypeCharset
public function testContentTypeCharset()
{
$response = new Response();
$response->headers->set('Content-Type', 'text/css');
// force fixContentType() to be called
$response->__toString();
$this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type'));
}