Adding test to formHelper. Testing checkbox in response to #4869

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7146 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-06-09 12:34:30 +00:00
parent 2d8e63ae7b
commit 8c32547351

View file

@ -2332,6 +2332,13 @@ class FormHelperTest extends CakeTestCase {
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][field]', 'value' => '1', 'id' => 'ModelField'))
);
$this->assertTags($result, $expected);
$result = $this->Form->checkbox('Model.field', array('checked' => 'checked'));
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'ModelField_'),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][field]', 'value' => '1', 'id' => 'ModelField', 'checked' => 'checked'))
);
$this->assertTags($result, $expected);
$this->Form->validationErrors['Model']['field'] = 1;
$this->Form->data['Contact']['published'] = 1;