mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Deprecating $escape for HtmlHelper::tag() use $attributes['escape'] instead. Test case added.
This commit is contained in:
parent
56d2423bc3
commit
136b4db7ad
2 changed files with 10 additions and 13 deletions
|
@ -708,7 +708,10 @@ class HtmlHelper extends AppHelper {
|
|||
* @access public
|
||||
*/
|
||||
function tag($name, $text = null, $attributes = array(), $escape = false) {
|
||||
if ($escape) {
|
||||
if ($escape || isset($attributes['escape']) && $attributes['escape']) {
|
||||
if (is_array($attributes)) {
|
||||
unset($attributes['escape']);
|
||||
}
|
||||
$text = h($text);
|
||||
}
|
||||
if (!is_array($attributes)) {
|
||||
|
|
|
@ -123,16 +123,17 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
* endTest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
function endTest() {
|
||||
Configure::write('App.encoding', $this->_appEncoding);
|
||||
Configure::write('Asset', $this->_asset);
|
||||
Configure::write('debug', $this->_debug);
|
||||
ClassRegistry::flush();
|
||||
unset($this->Html);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1108,6 +1109,9 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->tag('div', '<text>', array('class' => 'class-name'), true);
|
||||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||
|
||||
$result = $this->Html->tag('div', '<text>', array('class' => 'class-name', 'escape' => true));
|
||||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||
|
||||
$result = $this->Html->tag('div', '<text>', 'class-name', true);
|
||||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||
}
|
||||
|
@ -1145,15 +1149,5 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->para('class-name', '<text>', array(), true);
|
||||
$this->assertTags($result, array('p' => array('class' => 'class-name'), '<text>', '/p'));
|
||||
}
|
||||
/**
|
||||
* endTest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function endTest() {
|
||||
ClassRegistry::flush();
|
||||
unset($this->Html);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue