Index: modules/field/field.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.test,v
retrieving revision 1.9
diff -u -p -r1.9 field.test
--- modules/field/field.test	31 Mar 2009 01:49:51 -0000	1.9
+++ modules/field/field.test	6 Apr 2009 02:50:43 -0000
@@ -1,8 +1,6 @@
 <?php
 // $Id: field.test,v 1.9 2009/03/31 01:49:51 webchick Exp $
 
-// TODO : use drupalCreateField() / drupalCreateFieldInstance() all over ?
-
 class FieldAttachTestCase extends DrupalWebTestCase {
   public static function getInfo() {
     return array(
@@ -946,19 +944,21 @@ class FieldTestCase extends DrupalWebTes
       );
       field_create_field($field_definition);
       $this->fail(t('Cannot create a field with no type.'));
-    } catch (FieldException $e) {
+    } 
+    catch (FieldException $e) {
       $this->pass(t('Cannot create a field with no type.'));
     }
-    
+
     // Check that field name is required.
     try {
       $field_definition = array('type' => 'test_field');
       field_create_field($field_definition);
       $this->fail(t('Cannot create an unnamed field.'));
-    } catch (FieldException $e) {
+    }
+    catch (FieldException $e) {
       $this->pass(t('Cannot create an unnamed field.'));
     }
- 
+
     $field_definition = array(
       'field_name' => drupal_strtolower($this->randomName()),
       'type' => 'test_field',
@@ -1013,8 +1013,10 @@ class FieldTestCase extends DrupalWebTes
     // TODO: Also test deletion of the data stored in the field ?
 
     // Create two fields (so we can test that only one is deleted).
-    $this->field = $this->drupalCreateField('test_field', 'test_field_name');
-    $this->another_field = $this->drupalCreateField('test_field', 'another_test_field_name');
+    $this->field = array('field_name' => 'test_field_name', 'type' => 'test_field');
+    field_create_field($this->field);
+    $this->another_field = array('field_name' => 'another_test_field_name', 'type' => 'test_field');
+    field_create_field($this->another_field);
 
     // Create instances for each.
     $this->instance_definition = array(
@@ -1073,8 +1075,11 @@ class FieldInstanceTestCase extends Drup
 
   function setUp() {
     parent::setUp('field_sql_storage', 'field', 'field_test');
-
-    $this->field = $this->drupalCreateField('test_field');
+    $this->field = array(
+      'field_name' => drupal_strtolower($this->randomName()),
+      'type' => 'test_field',
+    );
+    field_create_field($this->field);
     $this->instance_definition = array(
       'field_name' => $this->field['field_name'],
       'bundle' => FIELD_TEST_BUNDLE,
Index: modules/field/modules/text/text.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.test,v
retrieving revision 1.3
diff -u -p -r1.3 text.test
--- modules/field/modules/text/text.test	31 Mar 2009 01:49:52 -0000	1.3
+++ modules/field/modules/text/text.test	6 Apr 2009 16:22:11 -0000
@@ -24,13 +24,32 @@ class TextFieldTestCase extends DrupalWe
   function testTextFieldValidation() {
     // Create a field with settings to validate.
     $max_length = 3;
-    $field = $this->drupalCreateField('text', NULL, array('settings' => array('max_length' => $max_length)));
-    $this->instance = $this->drupalCreateFieldInstance($field['field_name'], 'text_textfield', 'text_default', FIELD_TEST_BUNDLE);
-
+    $this->field = array(
+      'field_name' => drupal_strtolower($this->randomName()),
+      'max_length' => $max_length,
+      'type' => 'text',
+      'settings' => array(
+        'max_length' => $max_length,
+      )
+    );
+    field_create_field($this->field);
+    $this->instance = array(
+      'field_name' => $this->field['field_name'],
+      'bundle' => FIELD_TEST_BUNDLE,
+      'widget' => array(
+        'type' => 'text_textfield',
+      ),
+      'display' => array(
+        'full' => array(
+          'type' => 'text_default',
+        ),
+      ),
+    );
+    field_create_instance($this->instance);
     // Test valid and invalid values with field_attach_validate().
     $entity = field_test_create_stub_entity(0, 0, FIELD_TEST_BUNDLE);
     for ($i = 0; $i <= $max_length + 2; $i++) {
-      $entity->{$field['field_name']}[0]['value'] = str_repeat('x', $i);
+      $entity->{$this->field['field_name']}[0]['value'] = str_repeat('x', $i);
       try {
         field_attach_validate('test_entity', $entity);
         $this->assertTrue($i <= $max_length, "Length $i does not cause validation error when max_length is $max_length");
@@ -48,9 +67,24 @@ class TextFieldTestCase extends DrupalWe
    */
   function testTextfieldWidget() {
     // Create a field
-    $field = $this->drupalCreateField('text');
-    $this->instance = $this->drupalCreateFieldInstance($field['field_name'], 'text_textfield', 'text_default', FIELD_TEST_BUNDLE);
-
+    $field_definition = array(
+      'field_name' => drupal_strtolower($this->randomName()),
+		  'type' => 'text',
+    );
+    field_create_field($field_definition);
+    $this->instance = array(
+      'field_name' => $field_definition['field_name'],
+      'bundle' => 'FIELD_TEST_BUNDLE',
+      'widget' => array(
+        'type' => 'text_textfield',
+      ),
+      'display' => array(
+        'full' => array(
+          'type' => 'text_default',
+        ),
+      ),
+    );
+    field_create_instance($this->instance);
   }
 
   /**
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.92
diff -u -p -r1.92 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	30 Mar 2009 05:35:35 -0000	1.92
+++ modules/simpletest/drupal_web_test_case.php	6 Apr 2009 02:21:25 -0000
@@ -2078,58 +2078,5 @@ class DrupalWebTestCase {
     $match = is_array($code) ? in_array($curl_code, $code) : $curl_code == $code;
     return $this->assertTrue($match, $message ? $message : t('HTTP response expected !code, actual !curl_code', array('!code' => $code, '!curl_code' => $curl_code)), t('Browser'));
   }
-
-  /**
-   * TODO write documentation.
-   * @param $type
-   * @param $field_name
-   * @param $settings
-   * @return unknown_type
-   */
-  protected function drupalCreateField($type, $field_name = NULL, $settings = array()) {
-    if (!isset($field_name)) {
-      $field_name = strtolower($this->randomName());
-    }
-    $field_definition = array(
-      'field_name' => $field_name,
-      'type' => $type,
-    );
-    $field_definition += $settings;
-    field_create_field($field_definition);
-
-    $field = field_read_field($field_name);
-    $this->assertTrue($field, t('Created field @field_name of type @type.', array('@field_name' => $field_name, '@type' => $type)));
-
-    return $field;
-  }
-
-  /**
-   * TODO write documentation.
-   * @param $field_name
-   * @param $widget_type
-   * @param $display_type
-   * @param $bundle
-   * @return unknown_type
-   */
-  protected function drupalCreateFieldInstance($field_name, $widget_type, $formatter_type, $bundle) {
-    $instance_definition = array(
-      'field_name' => $field_name,
-      'bundle' => $bundle,
-      'widget' => array(
-        'type' => $widget_type,
-      ),
-      'display' => array(
-        'full' => array(
-          'type' => $formatter_type,
-        ),
-      ),
-    );
-    field_create_instance($instance_definition);
-
-    $instance = field_read_instance($field_name, $bundle);
-    $this->assertTrue($instance, t('Created instance of field @field_name on bundle @bundle.', array('@field_name' => $field_name, '@bundle' => $bundle)));
-
-    return $instance;
-  }
 }
 
