Permalink
Browse files

Added test for HTML5 `FormHelper::input()` integer to number in $map

  • Loading branch information...
1 parent 333f365 commit 804e88b092f38f95d4b23ad72a7f34c4f57b969e Dean Sofer committed Jul 26, 2011
Showing with 32 additions and 1 deletion.
  1. +32 −1 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -97,7 +97,8 @@ class Contact extends CakeTestModel {
'password' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null),
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
- 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
+ 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null),
+ 'age' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => null)
);
/**
@@ -886,6 +887,36 @@ public function testTextFieldGenerationForFloats() {
'/div'
);
}
+
+/**
+ * Tests correct generation of text fields for double and float fields
+ *
+ * @access public
+ * @return void
+ */
+ public function testTextFieldTypeNumberGenerationForIntegers() {
+ $model = ClassRegistry::getObject('Contact');
+ $model->setSchema(array('foo' => array(
+ 'type' => 'integer',
+ 'null' => false,
+ 'default' => null,
+ 'length' => null
+ )));
+
+ $this->Form->create('Contact');
+ $result = $this->Form->input('foo');
+ $expected = array(
+ 'div' => array('class' => 'input text'),
+ 'label' => array('for' => 'ContactFoo'),
+ 'Foo',
+ '/label',
+ array('input' => array(
+ 'type' => 'number', 'name' => 'data[Contact][foo]',
+ 'id' => 'ContactFoo'
+ )),
+ '/div'
+ );
+ }
/**
* testFormSecurityMultipleFields method

0 comments on commit 804e88b

Please sign in to comment.