Skip to content
This repository
Browse code

Test Case for Formhelper Bug

  • Loading branch information...
commit 9c24f81379cb8fa7f9e9c1a25320e45ba6703155 1 parent cd2dca2
authored February 29, 2012
16  lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -6528,8 +6528,8 @@ public function testCreateCustomRoute() {
6528 6528
  */
6529 6529
 	public function testCreateWithInputDefaults() {
6530 6530
 		$this->Form->create('User', array(
6531  
-			'inputDefaults' => array('div' => false, 'label' => false)
6532  
-		));
  6531
+			'inputDefaults' => array('div' => false, 'label' => false, 'error' => array('attributes'=>array('wrap' => 'small', 'class' => 'error')))
  6532
+		));	
6533 6533
 		$result = $this->Form->input('username');
6534 6534
 		$expected = array(
6535 6535
 			'input' => array('type' => 'text', 'name' => 'data[User][username]', 'id' => 'UserUsername')
@@ -6544,6 +6544,18 @@ public function testCreateWithInputDefaults() {
6544 6544
 			'/div'
6545 6545
 		);
6546 6546
 		$this->assertTags($result, $expected);
  6547
+		
  6548
+		$User = ClassRegistry::getObject('User');
  6549
+		$User->validationErrors['username'] = array('empty');
  6550
+		$result = $this->Form->input('username', array('div' => true, 'label' => 'username', 'error' => array('empty' => __('Required'))));
  6551
+		$expected = array(
  6552
+			'div' => array('class' => 'input text error'),
  6553
+			'label' => array('for' => 'UserUsername'), 'username', '/label',
  6554
+			'input' => array('class' => 'form-error', 'type' => 'text', 'name' => 'data[User][username]', 'id' => 'UserUsername'),
  6555
+			'small' => array('class' => 'error'), 'Required', '/small',
  6556
+			'/div'
  6557
+		);
  6558
+		$this->assertTags($result, $expected);
6547 6559
 	}
6548 6560
 
6549 6561
 /**

0 notes on commit 9c24f81

Please sign in to comment.
Something went wrong with that request. Please try again.