Index: upload.test
===================================================================
--- upload.test	(revision 500)
+++ upload.test	(working copy)
@@ -238,10 +238,11 @@
     $this->drupalLogin($user);
 
     // not a image
-    $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/functional/upload.test");
+    //$img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/functional/upload.test");
+    $img_path = realpath(drupal_get_path('module', 'simpletest'). "/files/html-1.txt");
     $edit = array('files[picture_upload]' => $img_path);
     $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save'));
-    $this->assertRaw(t('The selected file %file could not be uploaded. Only JPEG, PNG and GIF images are allowed.', array('%file' => 'upload.test')), 'The uploaded file was not an image.');
+    $this->assertRaw(t('The selected file %file could not be uploaded. Only JPEG, PNG and GIF images are allowed.', array('%file' => basename($img_path))), 'The uploaded file was not an image.');
     variable_set('user_pictures', $old_pic_set);
 
     // do we have to check users roles?
@@ -275,7 +276,8 @@
         // changing actual setting;
         $old_dim = variable_get('user_picture_dimensions', '85x85');
         $old_size = variable_get('user_picture_file_size', '30');
-        $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/files/image-2.jpg");
+        //$img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/files/image-2.jpg");
+        $img_path = realpath(drupal_get_path('module', 'simpletest'). "/files/image-2.jpg");
         $info = image_get_info($img_path);
 
         // set new variables;
@@ -284,6 +286,12 @@
         variable_set('user_picture_dimensions', $test_dim);
         variable_set('user_picture_file_size', $test_size);
 
+        // Create pictures folder
+        $file_dir = file_directory_path();
+        $picture_dir = variable_get('user_picture_path', 'pictures');
+        $picture_path = $file_dir .'/'.$picture_dir;
+        $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path');
+        
         // TEST:
         $edit = array('files[picture_upload]' => $img_path);
         $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save'));
@@ -342,11 +350,17 @@
         variable_set('user_picture_dimensions', $test_dim);
         variable_set('user_picture_file_size', $test_size);
 
+        // Create pictures folder
+        $file_dir = file_directory_path();
+        $picture_dir = variable_get('user_picture_path', 'pictures');
+        $picture_path = $file_dir .'/'.$picture_dir;
+        $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path');
+        
         // TEST:
         $edit = array('files[picture_upload]' => $img_path);
         $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save'));
         $picture_dir = variable_get('user_picture_path', 'pictures');
-        $picture = $picture_dir .'/picture-'.$user->uid.'.jpg';
+        $picture = $picture_dir .'/picture-'.$user->uid.'.png';
 
         // get full url to the user's image
         $picture_url = file_create_url($picture);
@@ -387,7 +401,7 @@
         // changing actual setting;
         $old_dim = variable_get('user_picture_dimensions', '85x85');
         $old_size = variable_get('user_picture_file_size', '30');
-        $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/files/image-2.jpg");
+        $img_path = realpath(drupal_get_path('module', 'simpletest'). "/files/image-2.jpg");
         $info = image_get_info($img_path);
         // set new variables;
         $test_size = floor(filesize($img_path) / 1000) + 1;
@@ -395,6 +409,12 @@
         variable_set('user_picture_dimensions', $test_dim);
         variable_set('user_picture_file_size', $test_size);
 
+        // Create pictures folder
+        $file_dir = file_directory_path();
+        $picture_dir = variable_get('user_picture_path', 'pictures');
+        $picture_path = $file_dir .'/'.$picture_dir;
+        $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path');
+        
         // TEST:
         $edit = array('picture' => $img_path);
         $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save'));
@@ -436,7 +456,8 @@
         // changing actual setting;
         $old_dim = variable_get('user_picture_dimensions', '85x85');
         $old_size = variable_get('user_picture_file_size', '30');
-        $img_path = realpath("modules/tests/image-2.jpg");
+        //$img_path = realpath("modules/tests/image-2.jpg");
+        $img_path = realpath(drupal_get_path('module', 'simpletest'). "/files/image-2.jpg");
         $info = image_get_info($img_path);
         // invalid size
         // restore one and set another
@@ -482,7 +503,7 @@
       // changing actual setting;
       $old_dim = variable_get('user_picture_dimensions', '85x85');
       $old_size = variable_get('user_picture_file_size', '30');
-      $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/files/image-2.jpg");
+      $img_path = realpath(drupal_get_path('module', 'simpletest'). "/files/image-2.jpg");
       $info = image_get_info($img_path);
 
       // valid size & dimensions
@@ -492,6 +513,12 @@
       variable_set('user_picture_dimensions', $test_dim);
       variable_set('user_picture_file_size', $test_size);
 
+      // Create pictures folder
+      $file_dir = file_directory_path();
+      $picture_dir = variable_get('user_picture_path', 'pictures');
+      $picture_path = $file_dir .'/'.$picture_dir;
+      $pic_check = file_check_directory($picture_path, FILE_CREATE_DIRECTORY, 'user_picture_path');
+        
       // TEST:
       $edit = array('files[picture_upload]' => $img_path);
       $this->drupalPost('user/'.$user->uid.'/edit', $edit, t('Save'));
