Skip to content

Commit

Permalink
Adding test case for 'required' class adding to wrapping div based on…
Browse files Browse the repository at this point in the history
… model validations. Refs #654
  • Loading branch information
ADmad committed Apr 30, 2010
1 parent 734e4fa commit 0471ea0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cake/tests/cases/libs/view/helpers/form.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class Contact extends CakeTestModel {
'required_one' => array('required' => array('rule' => array('notEmpty'))),
'imnotrequired' => array('required' => false, 'rule' => 'alphaNumeric', 'allowEmpty' => true),
'imalsonotrequired' => array('alpha' => array('rule' => 'alphaNumeric','allowEmpty' => true),
'imnotrequiredeither' => array('required' => true, 'rule' => array('between', 5, 30), 'allowEmpty' => true),
'between' => array('rule' => array('between', 5, 30))));

/**
Expand Down Expand Up @@ -5593,6 +5594,20 @@ function testFormMagicInput() {
);
$this->assertTags($result, $expected);

$result = $this->Form->input('Contact.iamnotrequiredeither');
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'ContactIamnotrequiredeither'),
'Iamnotrequiredeither',
'/label',
'input' => array(
'type' => 'text', 'name' => 'data[Contact][iamnotrequiredeither]',
'id' => 'ContactIamnotrequiredeither'
),
'/div'
);
$this->assertTags($result, $expected);

extract($this->dateRegex);
$now = strtotime('now');

Expand Down

0 comments on commit 0471ea0

Please sign in to comment.