updated core to 7.54
This commit is contained in:
@@ -152,4 +152,50 @@ class NumberFieldTestCase extends DrupalWebTestCase {
|
||||
);
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test number_float field.
|
||||
*/
|
||||
function testNumberFloatField() {
|
||||
$this->field = array(
|
||||
'field_name' => drupal_strtolower($this->randomName()),
|
||||
'type' => 'number_float',
|
||||
'settings' => array(
|
||||
'precision' => 8, 'scale' => 4, 'decimal_separator' => '.',
|
||||
)
|
||||
);
|
||||
field_create_field($this->field);
|
||||
$this->instance = array(
|
||||
'field_name' => $this->field['field_name'],
|
||||
'entity_type' => 'test_entity',
|
||||
'bundle' => 'test_bundle',
|
||||
'widget' => array(
|
||||
'type' => 'number',
|
||||
),
|
||||
'display' => array(
|
||||
'default' => array(
|
||||
'type' => 'number_float',
|
||||
),
|
||||
),
|
||||
);
|
||||
field_create_instance($this->instance);
|
||||
|
||||
$langcode = LANGUAGE_NONE;
|
||||
$value = array(
|
||||
'9.' => '9',
|
||||
'.' => '0',
|
||||
'123.55' => '123.55',
|
||||
'.55' => '0.55',
|
||||
'-0.55' => '-0.55',
|
||||
);
|
||||
foreach($value as $key => $value) {
|
||||
$edit = array(
|
||||
"{$this->field['field_name']}[$langcode][0][value]" => $key,
|
||||
);
|
||||
$this->drupalPost('test-entity/add/test-bundle', $edit, t('Save'));
|
||||
$this->assertNoText("PDOException");
|
||||
$this->assertRaw($value, 'Correct value is displayed.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user