mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding patch and test for ticket #2369
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4881 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
0d69e3a085
commit
c529d363a8
2 changed files with 9 additions and 2 deletions
|
@ -507,8 +507,10 @@ class HtmlHelper extends AppHelper {
|
|||
$out = array();
|
||||
|
||||
foreach($options as $optValue => $optTitle) {
|
||||
$optionsHere = array('value' => $optValue);
|
||||
$optValue == $value ? $optionsHere['checked'] = 'checked' : null;
|
||||
$optionsHere = array('value' => $optValue);
|
||||
if ($value !== false && $optValue == $value) {
|
||||
$optionsHere['checked'] = 'checked';
|
||||
}
|
||||
$parsedOptions = $this->_parseAttributes(array_merge($htmlAttributes, $optionsHere), null, '', ' ');
|
||||
$individualTagName = $this->field() . "_{$optValue}";
|
||||
$out[] = sprintf($this->tags['radio'], $this->model(), $this->field(), $individualTagName, $parsedOptions, $optTitle);
|
||||
|
|
|
@ -53,6 +53,11 @@ class HtmlHelperTest extends UnitTestCase {
|
|||
|
||||
$this->assertPattern($expected, $result);
|
||||
}
|
||||
|
||||
function testRadio() {
|
||||
$result = $this->Html->radio('Tests/process', Array('0'=> 'zero', '1'=>'one'));
|
||||
$this->assertNoPattern('/checked="checked"/', $result);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
unset($this->Html);
|
||||
|
|
Loading…
Reference in a new issue