From c34f404dabb4c1f4ff5d8ab4c64d78fde84f0538 Mon Sep 17 00:00:00 2001
From: Sofian Benaissa <sofian@koumbit.org>
Date: Fri, 30 Jul 2010 20:45:19 -0400
Subject: [PATCH] testUpdateField() ignores sqlite since it has no fixed precision fields

---
 modules/field/tests/field.test |   54 +++++++++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test
index 36d6284..95a8fdd 100644
--- a/modules/field/tests/field.test
+++ b/modules/field/tests/field.test
@@ -2076,29 +2076,37 @@ class FieldCrudTestCase extends FieldTestCase {
    * Test updating a field.
    */
   function testUpdateField() {
-    // Create a decimal 5.2 field.
-    $field = array('field_name' => 'decimal53', 'type' => 'number_decimal', 'cardinality' => 3, 'settings' => array('precision' => 5, 'scale' => 2));
-    $field = field_create_field($field);
-    $instance = array('field_name' => 'decimal53', 'entity_type' => 'test_entity', 'bundle' => 'test_bundle');
-    $instance = field_create_instance($instance);
-
-    // Update it to a deciaml 5.3 field.
-    $field['settings']['scale'] = 3;
-    field_update_field($field);
-
-    // Save values with 2, 3, and 4 decimal places.
-    $entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
-    $entity->decimal53[LANGUAGE_NONE][0]['value'] = '1.23';
-    $entity->decimal53[LANGUAGE_NONE][1]['value'] = '1.235';
-    $entity->decimal53[LANGUAGE_NONE][2]['value'] = '1.2355';
-    field_attach_insert('test_entity', $entity);
-    $entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
-
-    // Verify that the updated 5.3 field rounds to 3 decimal places.
-    field_attach_load('test_entity', array(0 => $entity));
-    $this->assertEqual($entity->decimal53[LANGUAGE_NONE][0]['value'], '1.23', t('2 decimal places are left alone'));
-    $this->assertEqual($entity->decimal53[LANGUAGE_NONE][1]['value'], '1.235', t('3 decimal places are left alone'));
-    $this->assertEqual($entity->decimal53[LANGUAGE_NONE][2]['value'], '1.236', t('4 decimal places are rounded to 3'));
+    $driver = db_driver();
+    switch ($driver) {
+      case 'sqlite':
+        // If the driver is sqlite we have no fixed precision database fields available so skip this test
+        break;
+      default:
+        // Create a decimal 5.2 field.
+        $field = array('field_name' => 'decimal53', 'type' => 'number_decimal', 'cardinality' => 3, 'settings' => array('precision' => 5, 'scale' => 2));
+        $field = field_create_field($field);
+        $instance = array('field_name' => 'decimal53', 'entity_type' => 'test_entity', 'bundle' => 'test_bundle');
+        $instance = field_create_instance($instance);
+
+        // Update it to a deciaml 5.3 field.
+        $field['settings']['scale'] = 3;
+        field_update_field($field);
+
+        // Save values with 2, 3, and 4 decimal places.
+        $entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
+        $entity->decimal53[LANGUAGE_NONE][0]['value'] = '1.23';
+        $entity->decimal53[LANGUAGE_NONE][1]['value'] = '1.235';
+        $entity->decimal53[LANGUAGE_NONE][2]['value'] = '1.2355';
+        field_attach_insert('test_entity', $entity);
+        $entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
+
+        // Verify that the updated 5.3 field rounds to 3 decimal places.
+        field_attach_load('test_entity', array(0 => $entity));
+        $this->assertEqual($entity->decimal53[LANGUAGE_NONE][0]['value'], '1.23', t('2 decimal places are left alone'));
+        $this->assertEqual($entity->decimal53[LANGUAGE_NONE][1]['value'], '1.235', t('3 decimal places are left alone'));
+        $this->assertEqual($entity->decimal53[LANGUAGE_NONE][2]['value'], '1.236', t('4 decimal places are rounded to 3'));
+        break;
+    }
   }
 
   /**
-- 
1.7.0.4

