Browse Source

Remove redundant test and fix failing tests.

Remove a redundant test for disabling the fieldset, and fix remaining
fails.
Mark Story 12 years ago
parent
commit
6d1c29f612
2 changed files with 7 additions and 9 deletions
  1. 7 5
      src/View/Helper/FormHelper.php
  2. 0 4
      tests/TestCase/View/Helper/FormHelperTest.php

+ 7 - 5
src/View/Helper/FormHelper.php

@@ -736,7 +736,9 @@ class FormHelper extends Helper {
 		$model = false;
 		$fieldset = $legend = true;
 		$context = $this->_getContext();
-		// TODO add context->fields()
+
+		$modelFields = $context->fieldNames();
+
 		if (is_array($fields)) {
 			if (array_key_exists('legend', $fields) && !in_array('legend', $modelFields)) {
 				$legend = $fields['legend'];
@@ -755,6 +757,9 @@ class FormHelper extends Helper {
 			$fields = array();
 		}
 
+		if (empty($fields)) {
+			$fields = $modelFields;
+		}
 		if (isset($options['legend'])) {
 			$legend = $options['legend'];
 		}
@@ -762,10 +767,6 @@ class FormHelper extends Helper {
 			$fieldset = $options['fieldset'];
 		}
 
-		if (empty($fields)) {
-			$fields = $modelFields;
-		}
-
 		if ($legend === true) {
 			$actionName = __d('cake', 'New %s');
 			$isCreate = $context->isCreate();
@@ -799,6 +800,7 @@ class FormHelper extends Helper {
 			$fieldsetClass = '';
 		}
 
+		// TODO cleanup HTML helper usage.
 		if ($fieldset) {
 			if ($legend) {
 				$out = $this->Html->useTag('legend', $legend) . $out;

+ 0 - 4
tests/TestCase/View/Helper/FormHelperTest.php

@@ -2573,10 +2573,6 @@ class FormHelperTest extends TestCase {
 		$this->assertTags($result, $expected);
 
 		$this->Form->create($this->article);
-		$result = $this->Form->inputs(null, null, array('fieldset' => false));
-		$this->assertTags($result, $expected);
-
-		$this->Form->create($this->article);
 		$result = $this->Form->inputs(array('fieldset' => true, 'legend' => false));
 		$expected = array(
 			'fieldset' => array(),