diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 5f328ace1..7855d09ed 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -6528,8 +6528,8 @@ class FormHelperTest extends CakeTestCase { */ public function testCreateWithInputDefaults() { $this->Form->create('User', array( - 'inputDefaults' => array('div' => false, 'label' => false) - )); + 'inputDefaults' => array('div' => false, 'label' => false, 'error' => array('attributes'=>array('wrap' => 'small', 'class' => 'error'))) + )); $result = $this->Form->input('username'); $expected = array( 'input' => array('type' => 'text', 'name' => 'data[User][username]', 'id' => 'UserUsername') @@ -6544,6 +6544,18 @@ class FormHelperTest extends CakeTestCase { '/div' ); $this->assertTags($result, $expected); + + $User = ClassRegistry::getObject('User'); + $User->validationErrors['username'] = array('empty'); + $result = $this->Form->input('username', array('div' => true, 'label' => 'username', 'error' => array('empty' => __('Required')))); + $expected = array( + 'div' => array('class' => 'input text error'), + 'label' => array('for' => 'UserUsername'), 'username', '/label', + 'input' => array('class' => 'form-error', 'type' => 'text', 'name' => 'data[User][username]', 'id' => 'UserUsername'), + 'small' => array('class' => 'error'), 'Required', '/small', + '/div' + ); + $this->assertTags($result, $expected); } /**