--- upload/upload.test 2008-04-20 19:23:32.000000000 +0100 +++ user/upload.test 2008-04-20 19:23:33.000000000 +0100 @@ -1,5 +1,5 @@ drupalPost('admin/settings/uploads', $edit, t('Save configuration')); $this->assertText('The configuration options have been saved.', 'Upload setting saved.'); @@ -180,7 +180,7 @@ class UploadTestCase extends DrupalWebTe * @param string $filename Name of file to verifiy. */ function checkUploadedFile($filename) { - $file = realpath(file_directory_path() .'/'. $filename); + $file = realpath(file_directory_path() .'/simpletest/'. $filename); $this->drupalGet(file_directory_path() .'/'. $filename); $this->assertResponse(array(200), 'Uploaded '. $filename .' is accessible.'); $this->assertEqual(file_get_contents($file), $this->drupalGetContent(), 'Uploaded contents of '. $filename .' verified.'); @@ -238,11 +238,10 @@ class UploadPictureTestCase extends Drup $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'). "/files/html-1.txt"); + $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/functional/upload.test"); $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' => basename($img_path))), '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' => 'upload.test')), 'The uploaded file was not an image.'); variable_set('user_pictures', $old_pic_set); // do we have to check users roles? @@ -261,7 +260,6 @@ class UploadPictureTestCase extends Drup * * results: The image should be uploaded because ImageGDToolkit resizes the picture */ - function testWithGDinvalidDimension() { if ($this->_directory_test) if (image_get_toolkit()) { @@ -277,8 +275,7 @@ class UploadPictureTestCase extends Drup // 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"); + $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/files/image-2.jpg"); $info = image_get_info($img_path); // set new variables; @@ -287,12 +284,6 @@ class UploadPictureTestCase extends Drup 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')); @@ -326,7 +317,7 @@ class UploadPictureTestCase extends Drup * results: The image should be uploaded because ImageGDToolkit resizes the picture */ - function tstWithGDinvalidSize() { + function testWithGDinvalidSize() { if ($this->_directory_test) if (image_get_toolkit()) { // PREPARE: @@ -351,17 +342,11 @@ class UploadPictureTestCase extends Drup 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.'.png'; + $picture = $picture_dir .'/picture-'.$user->uid.'.jpg'; // get full url to the user's image $picture_url = file_create_url($picture); @@ -388,7 +373,7 @@ class UploadPictureTestCase extends Drup * * results: The image shouldn't be uploaded */ - function tstWithoutGDinvalidDimension() { + function testWithoutGDinvalidDimension() { if ($this->_directory_test) if (!image_get_toolkit()) { // PREPARE: @@ -402,7 +387,7 @@ class UploadPictureTestCase extends Drup // 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'). "/files/image-2.jpg"); + $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/files/image-2.jpg"); $info = image_get_info($img_path); // set new variables; $test_size = floor(filesize($img_path) / 1000) + 1; @@ -410,12 +395,6 @@ class UploadPictureTestCase extends Drup 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')); @@ -443,7 +422,7 @@ class UploadPictureTestCase extends Drup * * results: The image shouldn't be uploaded */ - function tstWithoutGDinvalidSize() { + function testWithoutGDinvalidSize() { if ($this->_directory_test) if (!image_get_toolkit()) { // PREPARE: @@ -457,8 +436,7 @@ class UploadPictureTestCase extends Drup // 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(drupal_get_path('module', 'simpletest'). "/files/image-2.jpg"); + $img_path = realpath("modules/tests/image-2.jpg"); $info = image_get_info($img_path); // invalid size // restore one and set another @@ -491,7 +469,7 @@ class UploadPictureTestCase extends Drup * * results: The image should be uploaded */ - function tstPictureIsValid() { + function testPictureIsValid() { if ($this->_directory_test) { // PREPARE: $old_pic_set = variable_get('user_pictures', 0); @@ -504,7 +482,7 @@ class UploadPictureTestCase extends Drup // 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'). "/files/image-2.jpg"); + $img_path = realpath(drupal_get_path('module', 'simpletest'). "/tests/files/image-2.jpg"); $info = image_get_info($img_path); // valid size & dimensions @@ -514,12 +492,6 @@ class UploadPictureTestCase extends Drup 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'));