Adding tests to disprove #5540. Closes #5540

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7707 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-10-06 23:57:27 +00:00
parent 38bc438fc7
commit 5ca239870d

View file

@ -1416,6 +1416,19 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->Form->data['Model']['0']['OtherModel']['field'] = 'My value';
$result = $this->Form->input('Model.0.OtherModel.field', array('id' => 'myId'));
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'myId'),
'Field',
'/label', #
'input' => array('type' => 'text', 'name' => 'data[Model][0][OtherModel][field]', 'value' => 'My value', 'id' => 'myId'),
'/div'
);
$this->assertTags($result, $expected);
unset($this->Form->data);
$this->Form->validationErrors['Model']['field'] = 'Badness!';
@ -1863,6 +1876,13 @@ class FormHelperTest extends CakeTestCase {
$this->Form->data['Model']['text'] = 'test';
$result = $this->Form->text('Model.text', array('id' => 'theID'));
$this->assertTags($result, array('input' => array('type' => 'text', 'name' => 'data[Model][text]', 'value' => 'test', 'id' => 'theID', 'class' => 'form-error')));
$this->Form->data['Model']['0']['OtherModel']['field'] = 'My value';
$result = $this->Form->text('Model.0.OtherModel.field', array('id' => 'myId'));
$expected = array(
'input' => array('type' => 'text', 'name' => 'data[Model][0][OtherModel][field]', 'value' => 'My value', 'id' => 'myId')
);
$this->assertTags($result, $expected);
}
/**
* testDefaultValue method