Commit b452ac58 authored by webchick's avatar webchick

Issue #2226395 by benjy | penyaskito: Expand Drupal6FieldInstance testing with a float field.

parent 3da1bdf6
......@@ -215,6 +215,46 @@ public function load() {
'field_name' => 'field_test_three',
'type_name' => 'story',
'weight' => 3,
'label' => 'Decimal Field',
'widget_type' => 'number',
'widget_settings' => serialize(array(
'default_value' => array(
0 => array(
'value' => '101',
'_error_element' => 'default_value_widget][field_decimal][0][value',
),
),
'default_value_php' => NULL,
)),
'display_settings' => serialize(array(
'weight' => 3,
'parent' => '',
'label' => array(
'format' => 'above',
),
'teaser' => array(
'format' => 'unformatted',
'exclude' => 0,
),
'full' => array(
'format' => 'us_2',
'exclude' => 0,
),
4 => array(
'format' => 'unformatted',
'exclude' => 0,
),
5 => array(
'format' => 'default',
'exclude' => 1,
),
)),
'description' => 'An example decimal field.',
))
->values(array(
'field_name' => 'field_test_four',
'type_name' => 'story',
'weight' => 3,
'label' => 'Float Field',
'widget_type' => 'number',
'widget_settings' => serialize(array(
......@@ -704,6 +744,23 @@ public function load() {
'db_columns' => 'a:0:{}',
'active' => 1,
))
->values(array(
'field_name' => 'field_test_four',
'module' => 'number',
'type' => 'number_float',
'global_settings' => serialize(array(
'prefix' => 'id-',
'suffix' => '',
'min' => '100',
'max' => '200',
'allowed_values' => '',
'allowed_values_php' => '',
)),
'multiple' => 0,
'db_storage' => 1,
'db_columns' => '',
'active' => 1,
))
->values(array(
'field_name' => 'field_test_email',
'module' => 'email',
......
......@@ -28,7 +28,7 @@ class MigrateFieldInstanceTest extends MigrateDrupalTestBase {
'image',
'datetime',
'node',
'field'
'field',
);
/**
......@@ -53,6 +53,7 @@ public function setUp() {
array(array('field_test'), array('node', 'field_test')),
array(array('field_test_two'), array('node', 'field_test_two')),
array(array('field_test_three'), array('node', 'field_test_three')),
array(array('field_test_four'), array('node', 'field_test_four')),
array(array('field_test_email'), array('node', 'field_test_email')),
array(array('field_test_link'), array('node', 'field_test_link')),
array(array('field_test_filefield'), array('node', 'field_test_filefield')),
......@@ -85,7 +86,7 @@ public function setUp() {
}
/*
/**
* Tests migration of file variables to file.settings.yml.
*/
public function testFieldInstanceSettings() {
......@@ -109,6 +110,16 @@ public function testFieldInstanceSettings() {
);
$this->assertEqual($field->getSettings(), $expected);
$field = entity_load('field_instance_config', 'node.story.field_test_four');
$this->assertEqual($field->label(), 'Float Field');
$expected = array(
'min' => 100,
'max' => 200,
'prefix' => 'id-',
'suffix' => '',
);
$this->assertEqual($field->getSettings(), $expected);
// Test email field.
$field = entity_load('field_instance_config', 'node.story.field_test_email');
$this->assertEqual($field->label(), 'Email Field');
......@@ -151,6 +162,7 @@ protected function createFields() {
'field_test' => 'text',
'field_test_two' => 'integer',
'field_test_three' => 'decimal',
'field_test_four' => 'float',
'field_test_email' => 'email',
'field_test_link' => 'link',
'field_test_filefield' => 'file',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment