mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Adding test case for 'required' class adding to wrapping div based on model validations. Refs #654
This commit is contained in:
parent
734e4fa87a
commit
0471ea046f
1 changed files with 15 additions and 0 deletions
|
@ -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');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue