Same name in other branches
  1. 7.x-1.x tests/exif_orientation.test \ExifOrientationTest::testUserPicture()

Test auto rotation of uploaded user profile pictures.

File

tests/exif_orientation.test, line 46

Class

ExifOrientationTest
@file Tests for exif_orientation.module.

Code

public function testUserPicture() {
    // No user picture style or dimensions.
    variable_set('user_picture_style', '');
    variable_set('user_picture_dimensions', '');
    $user1 = $this->drupalCreateUser();
    $this->saveUserPicture($user1);
    $this->assertImageIsRotated($user1->picture->uri);
    // Applied user picture style.
    variable_set('user_picture_style', 'medium');
    variable_set('user_picture_dimensions', '');
    $user2 = $this->drupalCreateUser();
    $this->saveUserPicture($user2);
    $this->assertImageIsRotated($user2->picture->uri);
    // Defined picture dimensions.
    variable_set('user_picture_style', '');
    variable_set('user_picture_dimensions', '50x50');
    $user3 = $this->drupalCreateUser();
    $this->saveUserPicture($user3);
    $this->assertImageIsRotated($user3->picture->uri);
    // Defined picture style and dimensions.
    variable_set('user_picture_style', 'medium');
    variable_set('user_picture_dimensions', '50x50');
    $user4 = $this->drupalCreateUser();
    $this->saveUserPicture($user4);
    $this->assertImageIsRotated($user4->picture->uri);
}