Adding test case for 'required' class adding to wrapping div based on model validations. Refs #654

This commit is contained in:
ADmad 2010-05-01 01:19:52 +05:30
parent 734e4fa87a
commit 0471ea046f

View file

@ -110,6 +110,7 @@ class Contact extends CakeTestModel {
'required_one' => array('required' => array('rule' => array('notEmpty'))), 'required_one' => array('required' => array('rule' => array('notEmpty'))),
'imnotrequired' => array('required' => false, 'rule' => 'alphaNumeric', 'allowEmpty' => true), 'imnotrequired' => array('required' => false, 'rule' => 'alphaNumeric', 'allowEmpty' => true),
'imalsonotrequired' => array('alpha' => array('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)))); 'between' => array('rule' => array('between', 5, 30))));
/** /**
@ -5593,6 +5594,20 @@ class FormHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $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); extract($this->dateRegex);
$now = strtotime('now'); $now = strtotime('now');