mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding test cases for HtmlHelper::charset()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6705 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ee94d5662c
commit
648d01e2e6
2 changed files with 13 additions and 13 deletions
|
@ -219,15 +219,12 @@ class HtmlHelper extends AppHelper {
|
|||
} elseif (isset($attributes['type']) && isset($types[$attributes['type']])) {
|
||||
$type = $types[$attributes['type']];
|
||||
}
|
||||
} else {
|
||||
if ($url !== null) {
|
||||
$inline = $url;
|
||||
}
|
||||
} elseif ($url !== null) {
|
||||
$inline = $url;
|
||||
}
|
||||
|
||||
$attributes = array_merge($type, $attributes);
|
||||
|
||||
$out = null;
|
||||
|
||||
if (isset($attributes['link'])) {
|
||||
if (isset($attributes['rel']) && $attributes['rel'] === 'icon') {
|
||||
$out = sprintf($this->tags['metalink'], $attributes['link'], $this->_parseAttributes($attributes, array('link')));
|
||||
|
@ -254,13 +251,7 @@ class HtmlHelper extends AppHelper {
|
|||
* @return string A meta tag containing the specified character set.
|
||||
*/
|
||||
function charset($charset = null) {
|
||||
if (is_null($charset)) {
|
||||
$charset = strtolower(Configure::read('App.encoding'));
|
||||
if (!$charset) {
|
||||
$charset = 'utf-8';
|
||||
}
|
||||
}
|
||||
|
||||
$charset = current(array_filter(array($charset, strtolower(Configure::read('App.encoding')), 'utf-8')));
|
||||
return $this->output(sprintf($this->tags['charset'], $charset));
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -141,6 +141,15 @@ class HtmlHelperTest extends UnitTestCase {
|
|||
Configure::write('Asset.filter.css', false);
|
||||
}
|
||||
|
||||
function testCharsetTag() {
|
||||
Configure::write('App.encoding', null);
|
||||
$this->assertPattern('/charset=utf-8"/', $this->Html->charset());
|
||||
|
||||
Configure::write('App.encoding', 'ISO-8859-1');
|
||||
$this->assertPattern('/charset=iso-8859-1"/', $this->Html->charset());
|
||||
$this->assertPattern('/charset=UTF-7"/', $this->Html->charset('UTF-7'));
|
||||
}
|
||||
|
||||
function testBreadcrumb() {
|
||||
$this->Html->addCrumb('First', '#first');
|
||||
$this->Html->addCrumb('Second', '#second');
|
||||
|
|
Loading…
Add table
Reference in a new issue