本文整理汇总了PHP中Zend_View::Doctype方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::Doctype方法的具体用法?PHP Zend_View::Doctype怎么用?PHP Zend_View::Doctype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::Doctype方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGravatar
/**
* @covers Robo47_View_Helper_Gravatar::Gravatar
* @dataProvider gravatarProvider
*/
public function testGravatar($email, $size, $rating, $default, $ssl, $separator, $params)
{
$view = new Zend_View();
$view->setEncoding('utf-8');
$view->Doctype(Zend_View_Helper_Doctype::XHTML1_STRICT);
$service = new Robo47_Service_Gravatar();
$helper = new Robo47_View_Helper_Gravatar($service);
$helper->setView($view);
$gravatarImageTag = $helper->Gravatar($email, $size, $rating, $default, $ssl, $separator, $params);
$src = $service->getUri($email, $size, $rating, $default, $ssl, $separator);
$alt = 'Gravatar ' . $service->getGravatarHash($email);
libxml_use_internal_errors(true);
$dom = new DOMDocument();
$dom->loadHTML('<html><head><title></title></head><body>' . $gravatarImageTag . '</body></html>');
libxml_use_internal_errors(false);
$nodes = $dom->getElementsByTagName('img');
$this->assertEquals(1, $nodes->length);
$image = $nodes->item(0);
$this->assertTrue($image->hasAttribute('src'), 'Image has no attribute "href"');
$this->assertTrue($image->hasAttribute('alt'), 'Image has no alt');
foreach ($params as $param => $value) {
$this->assertTrue($image->hasAttribute($param), 'Image has no attribute "' . $param . '"');
$this->assertEquals($value, $image->getAttribute($param), 'Image attribute "' . $param . '" has wrong value');
}
$srcAttribute = $image->getAttribute('src');
$this->assertEquals($src, $srcAttribute, 'Image attribute "src" has wrong value');
if (isset($params['alt'])) {
$altAttribute = $image->getAttribute('alt');
$this->assertEquals($params['alt'], $altAttribute, 'Image attribute "alt" has wrong value');
} else {
$altAttribute = $image->getAttribute('alt');
$this->assertEquals($alt, $altAttribute, 'Image attribute "alt" has wrong value');
}
}