| 7 user.test | UserPictureTestCase::testWithGDinvalidDimension() |
| 8 user.test | UserPictureTestCase::testWithGDinvalidDimension() |
Do the test: GD Toolkit is installed Picture has invalid dimension
results: The image should be uploaded because ImageGDToolkit resizes the picture
File
- modules/
user/ user.test, line 900 - Tests for user.module.
Code
function testWithGDinvalidDimension() {
if ($this->_directory_test && image_get_toolkit()) {
$this->drupalLogin($this->user);
$image = current($this->drupalGetTestFiles('image'));
$info = image_get_info($image->uri);
// Set new variables: invalid dimensions, valid filesize (0 = no limit).
$test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10);
variable_set('user_picture_dimensions', $test_dim);
variable_set('user_picture_file_size', 0);
$pic_path = $this->saveUserPicture($image);
// Check that the image was resized and is being displayed on the
// user's profile page.
$text = t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $test_dim));
$this->assertRaw($text, t('Image was resized.'));
$alt = t("@user's picture", array('@user' => format_username($this->user)));
$style = variable_get('user_picture_style', '');
$this->assertRaw(image_style_url($style, $pic_path), t("Image is displayed in user's edit page"));
// Check if file is located in proper directory.
$this->assertTrue(is_file($pic_path), t("File is located in proper directory"));
}
}
Login or register to post comments