Skip to content

Commit

Permalink
Merge branch '2.0' of github.com:cakephp/cakephp into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Aug 2, 2011
2 parents dbdc0a1 + 4da671c commit e083b21
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
33 changes: 32 additions & 1 deletion lib/Cake/Test/Case/View/Helper/FormHelperTest.php
Expand Up @@ -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)
);

/**
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -917,7 +917,8 @@ public function input($fieldName, $options = array()) {
'string' => 'text', 'datetime' => 'datetime',
'boolean' => 'checkbox', 'timestamp' => 'datetime',
'text' => 'textarea', 'time' => 'time',
'date' => 'date', 'float' => 'text'
'date' => 'date', 'float' => 'number',
'integer' => 'number'
);

if (isset($this->map[$type])) {
Expand Down

0 comments on commit e083b21

Please sign in to comment.