mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Applying patch from ticket #2763, adding test for it
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5278 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
c9a2da3e0c
commit
d9a0aa1c69
2 changed files with 4 additions and 1 deletions
|
@ -651,7 +651,7 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
|
||||
$output = null;
|
||||
if(isset($object) && ($options['value'] == 0 || $options['value'] == 1)) {
|
||||
if(isset($object) && isset($options['value']) && ($options['value'] == 0 || $options['value'] == 1)) {
|
||||
$db =& ConnectionManager::getDataSource($object->useDbConfig);
|
||||
$value = $db->boolean($options['value']);
|
||||
$options['value'] = 1;
|
||||
|
|
|
@ -831,6 +831,9 @@ class FormHelperTest extends CakeTestCase {
|
|||
$result = $this->Form->checkbox('Model.field', array('value' => 'myvalue'));
|
||||
$this->assertEqual($result, '<input type="checkbox" name="data[Model][field]" type="checkbox" value="myvalue" id="ModelField" />');
|
||||
|
||||
$result = $this->Form->checkbox('Contact.field', array('value' => 'myvalue'));
|
||||
$this->assertEqual($result, '<input type="checkbox" name="data[Contact][field]" type="checkbox" value="myvalue" id="ContactField" />');
|
||||
|
||||
$this->Form->validationErrors['Model']['field'] = 1;
|
||||
$this->Form->data['Contact']['published'] = 1;
|
||||
$result = $this->Form->checkbox('Contact.published', array('id'=>'theID'));
|
||||
|
|
Loading…
Reference in a new issue