本文整理匯總了PHP中JDocument::setCharset方法的典型用法代碼示例。如果您正苦於以下問題:PHP JDocument::setCharset方法的具體用法?PHP JDocument::setCharset怎麽用?PHP JDocument::setCharset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JDocument
的用法示例。
在下文中一共展示了JDocument::setCharset方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRender
/**
* @todo Implement testRender().
*/
public function testRender()
{
$this->object = new JDocument();
$this->object->render();
$headers = JResponse::getHeaders();
$lastMod = false;
$contentType = false;
foreach ($headers as $header) {
if ($header['name'] == 'Last-Modified') {
$lastMod = $header;
}
if ($header['name'] == 'Content-Type') {
$contentType = $header;
}
}
$this->assertThat($lastMod, $this->equalTo(false));
$this->assertThat($contentType['value'], $this->equalTo('; charset=utf-8'));
$this->object->setModifiedDate('My date');
$this->object->setMimeEncoding('MyMimeType');
$this->object->setCharset('MyCharset');
$this->object->render();
$headers = JResponse::getHeaders();
$lastMod = false;
$contentType = false;
foreach ($headers as $header) {
if ($header['name'] == 'Last-Modified') {
$lastMod = $header;
}
if ($header['name'] == 'Content-Type') {
$contentType = $header;
}
}
$this->assertThat($lastMod['value'], $this->equalTo('My date'));
$this->assertThat($contentType['value'], $this->equalTo('mymimetype; charset=MyCharset'));
}
示例2: testGetSetCharset
/**
* Test...
*
* @return void
*/
public function testGetSetCharset()
{
$this->object->setCharset('My Character Set');
$this->assertThat($this->object->_charset, $this->equalTo('My Character Set'));
}
示例3: testEnsureSetCharsetReturnsThisObject
/**
* @testdox Test that setCharset returns an instance of $this
*/
public function testEnsureSetCharsetReturnsThisObject()
{
$this->assertSame($this->object, $this->object->setCharset('utf-8'));
}