From 115c6102b91c0a7876488efc7b789dbc003d19ef Mon Sep 17 00:00:00 2001 From: Robert Sworder Date: Thu, 5 Aug 2010 18:23:56 +0100 Subject: [PATCH] Changes to make tests pass... --- cake/libs/view/helpers/form.php | 6 ++++-- cake/tests/cases/libs/view/helpers/form.test.php | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 43a95fe7c..ddf07dc5a 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -718,7 +718,9 @@ class FormHelper extends AppHelper { if (isset($options['options'])) { $options['type'] = 'select'; } elseif (in_array($fieldKey, array('psword', 'passwd', 'password'))) { - $options['type'] = 'password'; + $options['type'] = 'password'; + } elseif (isset($options['checked'])) { + $options['type'] = 'checkbox'; } elseif (isset($this->fieldset[$modelKey]['fields'][$fieldKey])) { $fieldDef = $this->fieldset[$modelKey]['fields'][$fieldKey]; $type = $fieldDef['type']; @@ -772,7 +774,7 @@ class FormHelper extends AppHelper { } $autoLength = (!array_key_exists('maxlength', $options) && isset($fieldDef['length'])); - if ($autoLength && $options['type'] == 'text') { + if ($autoLength && $options['type'] == 'text') { $options['maxlength'] = $fieldDef['length']; } if ($autoLength && $fieldDef['type'] == 'float') { diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index d2730697e..0830e5212 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -5958,18 +5958,18 @@ class FormHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); - $result = $this->Form->input('User.stuff'); + $result = $this->Form->input('UserForm.stuff'); $expected = array( 'div' => array('class' => 'input text'), - 'label' => array('for' => 'UserStuff'), + 'label' => array('for' => 'UserFormStuff'), 'Stuff', '/label', 'input' => array( - 'type' => 'text', 'name' => 'data[User][stuff]', - 'id' => 'UserStuff', 'maxlength' => 10 + 'type' => 'text', 'name' => 'data[UserForm][stuff]', + 'id' => 'UserFormStuff', 'maxlength' => 10 ), '/div' - ); + ); $this->assertTags($result, $expected, true); }