Index: tests/imagefield.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/tests/imagefield.test,v
retrieving revision 1.4
diff -u -r1.4 imagefield.test
--- tests/imagefield.test	29 Apr 2010 01:34:48 -0000	1.4
+++ tests/imagefield.test	29 Jun 2010 19:16:14 -0000
@@ -6,7 +6,10 @@
    * Implementation of setUp().
    */
   function setUp() {
-    parent::setUp('imagefield');
+    // Views is included here just so that it doesn't whine when CCK tries to
+    // clear the caches.
+    $modules = array_merge(func_get_args(), array('content', 'filefield', 'imagefield', 'token', 'views'));
+    call_user_func_array(array($this, 'parent::setUp'), $modules);
   }
 
   /**
@@ -56,7 +59,7 @@
     $test_file = $this->getTestFile('image');
 
     // Create a new node with the uploaded file.
-    $nid = $this->uploadNodeFile($test_file, $field_name, $type->name);
+    $nid = $this->uploadNodeFile($test_file, $field, $type->name);
 
     // Add an alt and title value.
     $edit = array(
@@ -140,8 +143,10 @@
    * Implementation of setUp().
    */
   function setUp() {
-    // Allow the FileField Validation method to setup a FileField.
-    parent::setUp('imagefield');
+    // Views is included here just so that it doesn't whine when CCK tries to
+    // clear the caches.
+    $modules = array_merge(func_get_args(), array('content', 'filefield', 'imagefield', 'token', 'views'));
+    call_user_func_array(array($this, 'parent::setUp'), $modules);
 
     // Then we'll convert it to an ImageField.
     $widget_options = array(
@@ -171,19 +176,19 @@
     // Set the resolution to a minimum to check on x axis.
     $widget_options = array('min_resolution' => ($width + 1) . 'x1');
     $this->updateFileField($this->field['field_name'], $type->name, array(), $widget_options);
-    $this->uploadNodeFile($test_file, $this->field['field_name'], $type->name);
+    $this->uploadNodeFile($test_file, $this->field, $type->name);
     $this->assertRaw(t('The image is too small; the minimum dimensions are'), t('Image could not be saved when too small horizontally.'));
 
     // Set the resolution to a minimum to check on y axis.
     $widget_options = array('min_resolution' => '1x' . ($height + 1));
     $this->updateFileField($this->field['field_name'], $type->name, array(), $widget_options);
-    $this->uploadNodeFile($test_file, $this->field['field_name'], $type->name);
+    $this->uploadNodeFile($test_file, $this->field, $type->name);
     $this->assertRaw('The image is too small; the minimum dimensions are', t('Image could not be saved when too small vertically.'));
 
     // Remove the minimum dimension add a max dimension on the x axis.
     $widget_options = array('min_resolution' => '', 'max_resolution' => ($width/4) . 'x40000');
     $this->updateFileField($this->field['field_name'], $type->name, array(), $widget_options);
-    $nid = $this->uploadNodeFile($test_file, $this->field['field_name'], $type->name);
+    $nid = $this->uploadNodeFile($test_file, $this->field, $type->name);
     $this->assertRaw('The image was resized to fit within the maximum allowed dimensions', t('Image resized when too large horizontally.'));
     // Validate the image size.
     $node = node_load($nid, NULL, TRUE);
@@ -194,7 +199,7 @@
     // Add a max dimension on the y axis.
     $widget_options = array('max_resolution' => '40000x' . ($height/2));
     $this->updateFileField($this->field['field_name'], $type->name, array(), $widget_options);
-    $nid = $this->uploadNodeFile($test_file, $this->field['field_name'], $type->name);
+    $nid = $this->uploadNodeFile($test_file, $this->field, $type->name);
     $this->assertRaw('The image was resized to fit within the maximum allowed dimensions', t('Image resized when too large vertically.'));
     // Validate the image size.
     $node = node_load($nid, NULL, TRUE);
@@ -206,7 +211,7 @@
     // resized and the upload is allowed.
     $widget_options = array('min_resolution' => '360x240', 'max_resolution' => '360x240');
     $this->updateFileField($this->field['field_name'], $type->name, array(), $widget_options);
-    $nid = $this->uploadNodeFile($test_file, $this->field['field_name'], $type->name);
+    $nid = $this->uploadNodeFile($test_file, $this->field, $type->name);
     $this->assertNoRaw('The image was resized to fit within the maximum allowed dimensions', t('Image was not resized when uploaded with exact dimensions.'));
     // Validate the image size.
     $node = node_load($nid, NULL, TRUE);
@@ -217,13 +222,13 @@
     // Check that a scaled image will fit between the resolutions.
     $widget_options = array('min_resolution' => '300x200', 'max_resolution' => '340x220');
     $this->updateFileField($this->field['field_name'], $type->name, array(), $widget_options);
-    $nid = $this->uploadNodeFile($test_file, $this->field['field_name'], $type->name);
+    $nid = $this->uploadNodeFile($test_file, $this->field, $type->name);
     $this->assertRaw('The image was resized to fit within the maximum allowed dimensions', t('Image was resized when fitting between maximum and minimum dimensions.'));
 
     // Check that an image not fitting between dimensions will not upload.
     $widget_options = array('min_resolution' => '220x360', 'max_resolution' => '240x360');
     $this->updateFileField($this->field['field_name'], $type->name, array(), $widget_options);
-    $nid = $this->uploadNodeFile($test_file, $this->field['field_name'], $type->name);
+    $nid = $this->uploadNodeFile($test_file, $this->field, $type->name);
     $this->assertRaw('The image will not fit between the dimensions of', t('Image was not uploaded when not fitting between maximum and minimum dimensions.'));
   }
 
