From 1052d21522dc88a098033c8ba75177446813c7fc Mon Sep 17 00:00:00 2001 From: DarkAngelBGE Date: Wed, 30 Jul 2008 13:40:59 +0000 Subject: [PATCH] fixing broken tests in FormHelper, closes #5088 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7379 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helpers/form.php | 2 ++ cake/tests/cases/libs/view/helpers/form.test.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index f7290d614..9e30e8e77 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -1553,6 +1553,7 @@ class FormHelper extends AppHelper { $parents[] = $name; } $select = array_merge($select, $this->__selectOptions($title, $selected, $parents, $showParents, $attributes)); + if (!empty($name)) { if ($attributes['style'] === 'checkbox') { $select[] = sprintf($this->Html->tags['fieldsetstart'], $name); @@ -1579,6 +1580,7 @@ class FormHelper extends AppHelper { if ($showParents || (!in_array($title, $parents))) { $title = ife($attributes['escape'], h($title), $title); + if ($attributes['style'] === 'checkbox') { $htmlOptions['value'] = $name; diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 91e1cfdfb..7ba9574cb 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -4218,7 +4218,7 @@ class FormHelperTest extends CakeTestCase { 'berts_son_2' => 'Bertie') ), null, - array(), + array('showParents' => true), false ); @@ -4263,9 +4263,10 @@ class FormHelperTest extends CakeTestCase { ) ), null, - array(), + array('showParents' => true), false ); + $expected = array( 'select' => array('name' => 'data[Model][field]', 'id' => 'ModelField'), array('option' => array('value' => 1)),