Permalink
Browse files

Remove more redundant tests.

* Remove redundant tests around detecting required attribute.
* Remove test that didn't actually do anything special.
  • Loading branch information...
1 parent a8db3e3 commit 199a1b4ff8ec966c23130c852109a0d5e5a2f9b8 @markstory markstory committed Feb 26, 2014
Showing with 2 additions and 295 deletions.
  1. +2 −295 tests/TestCase/View/Helper/FormHelperTest.php
@@ -6440,300 +6440,6 @@ public function testDateTimeWithGetForms() {
}
/**
- * testEditFormWithData method
- *
- * test auto populating form elements from submitted data.
- *
- * @return void
- */
- public function testEditFormWithData() {
- $this->markTestIncomplete('Need to revisit once models work again.');
- $this->Form->request->data = array('Person' => array(
- 'id' => 1,
- 'first_name' => 'Nate',
- 'last_name' => 'Abele',
- 'email' => 'nate@example.com'
- ));
- $this->Form->request->addParams(array(
- 'models' => array('Person'),
- 'controller' => 'people',
- 'action' => 'add'
- ));
- $options = array(1 => 'Nate', 2 => 'Garrett', 3 => 'Larry');
-
- $this->Form->create();
- $result = $this->Form->select('People.People', $options, array('multiple' => true));
- $expected = array(
- 'input' => array('type' => 'hidden', 'name' => 'People[People]', 'value' => '', 'id' => 'PeoplePeople_'),
- 'select' => array(
- 'name' => 'People[People][]', 'multiple' => 'multiple', 'id' => 'PeoplePeople'
- ),
- array('option' => array('value' => 1)), 'Nate', '/option',
- array('option' => array('value' => 2)), 'Garrett', '/option',
- array('option' => array('value' => 3)), 'Larry', '/option',
- '/select'
- );
- $this->assertTags($result, $expected);
- }
-
-/**
- * Test that required fields are created for various types of validation.
- *
- * @return void
- */
- public function testFormInputRequiredDetection() {
- $this->markTestIncomplete('Need to revisit once models work again.');
- $this->Form->create('Contact');
-
- $result = $this->Form->input('Contact.non_existing');
- $expected = array(
- 'div' => array('class' => 'input text'),
- 'label' => array('for' => 'ContactNonExisting'),
- 'Non Existing',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[non_existing]',
- 'id' => 'ContactNonExisting'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.imrequired');
- $expected = array(
- 'div' => array('class' => 'input text required'),
- 'label' => array('for' => 'ContactImrequired'),
- 'Imrequired',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[imrequired]',
- 'id' => 'ContactImrequired',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.imalsorequired');
- $expected = array(
- 'div' => array('class' => 'input text required'),
- 'label' => array('for' => 'ContactImalsorequired'),
- 'Imalsorequired',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[imalsorequired]',
- 'id' => 'ContactImalsorequired',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.imrequiredtoo');
- $expected = array(
- 'div' => array('class' => 'input text required'),
- 'label' => array('for' => 'ContactImrequiredtoo'),
- 'Imrequiredtoo',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[imrequiredtoo]',
- 'id' => 'ContactImrequiredtoo',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.required_one');
- $expected = array(
- 'div' => array('class' => 'input text required'),
- 'label' => array('for' => 'ContactRequiredOne'),
- 'Required One',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[required_one]',
- 'id' => 'ContactRequiredOne',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.string_required');
- $expected = array(
- 'div' => array('class' => 'input text required'),
- 'label' => array('for' => 'ContactStringRequired'),
- 'String Required',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[string_required]',
- 'id' => 'ContactStringRequired',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.imnotrequired');
- $expected = array(
- 'div' => array('class' => 'input text'),
- 'label' => array('for' => 'ContactImnotrequired'),
- 'Imnotrequired',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[imnotrequired]',
- 'id' => 'ContactImnotrequired'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.imalsonotrequired');
- $expected = array(
- 'div' => array('class' => 'input text'),
- 'label' => array('for' => 'ContactImalsonotrequired'),
- 'Imalsonotrequired',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[imalsonotrequired]',
- 'id' => 'ContactImalsonotrequired'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.imalsonotrequired2');
- $expected = array(
- 'div' => array('class' => 'input text'),
- 'label' => array('for' => 'ContactImalsonotrequired2'),
- 'Imalsonotrequired2',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[imalsonotrequired2]',
- 'id' => 'ContactImalsonotrequired2'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.imnotrequiredeither');
- $expected = array(
- 'div' => array('class' => 'input text'),
- 'label' => array('for' => 'ContactImnotrequiredeither'),
- 'Imnotrequiredeither',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[imnotrequiredeither]',
- 'id' => 'ContactImnotrequiredeither'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.iamrequiredalways');
- $expected = array(
- 'div' => array('class' => 'input text required'),
- 'label' => array('for' => 'ContactIamrequiredalways'),
- 'Iamrequiredalways',
- '/label',
- 'input' => array(
- 'type' => 'text', 'name' => 'Contact[iamrequiredalways]',
- 'id' => 'ContactIamrequiredalways',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.boolean_field', array('type' => 'checkbox'));
- $expected = array(
- 'div' => array('class' => 'input checkbox required'),
- array('input' => array(
- 'type' => 'hidden',
- 'name' => 'Contact[boolean_field]',
- 'id' => 'ContactBooleanField_',
- 'value' => '0'
- )),
- array('input' => array(
- 'type' => 'checkbox',
- 'name' => 'Contact[boolean_field]',
- 'value' => '1',
- 'id' => 'ContactBooleanField'
- )),
- 'label' => array('for' => 'ContactBooleanField'),
- 'Boolean Field',
- '/label',
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.boolean_field', array('type' => 'checkbox', 'required' => true));
- $expected = array(
- 'div' => array('class' => 'input checkbox required'),
- array('input' => array(
- 'type' => 'hidden',
- 'name' => 'Contact[boolean_field]',
- 'id' => 'ContactBooleanField_',
- 'value' => '0'
- )),
- array('input' => array(
- 'type' => 'checkbox',
- 'name' => 'Contact[boolean_field]',
- 'value' => '1',
- 'id' => 'ContactBooleanField',
- 'required' => 'required'
- )),
- 'label' => array('for' => 'ContactBooleanField'),
- 'Boolean Field',
- '/label',
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('Contact.iamrequiredalways', array('type' => 'file'));
- $expected = array(
- 'div' => array('class' => 'input file required'),
- 'label' => array('for' => 'ContactIamrequiredalways'),
- 'Iamrequiredalways',
- '/label',
- 'input' => array(
- 'type' => 'file',
- 'name' => 'data[Contact][iamrequiredalways]',
- 'id' => 'ContactIamrequiredalways',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
- }
-
-/**
- * Test that required fields are created when only using ModelValidator::add().
- *
- * @return void
- */
- public function testFormInputRequiredDetectionModelValidator() {
- $this->markTestIncomplete('Need to revisit once models work again.');
-
- $this->Form->create('ContactTag');
- $result = $this->Form->input('ContactTag.iwillberequired');
- $expected = array(
- 'div' => array('class' => 'input text required'),
- 'label' => array('for' => 'ContactTagIwillberequired'),
- 'Iwillberequired',
- '/label',
- 'input' => array(
- 'name' => 'data[ContactTag][iwillberequired]',
- 'type' => 'text',
- 'id' => 'ContactTagIwillberequired',
- 'required' => 'required'
- ),
- '/div'
- );
- $this->assertTags($result, $expected);
- }
-
-/**
* testFormMagicInput method
*
* @return void
@@ -6972,7 +6678,8 @@ public function testFormMagicInputLabel() {
$this->assertTags($result, $expected);
$result = $this->Form->input('name', array(
- 'div' => false, 'label' => array('class' => 'mandatory', 'text' => 'My label')
+ 'div' => false,
+ 'label' => array('class' => 'mandatory', 'text' => 'My label')
));
$expected = array(
'label' => array('for' => 'name', 'class' => 'mandatory'),

0 comments on commit 199a1b4

Please sign in to comment.