You are here

public function ExifOrientationTest::testUserPicture in EXIF Orientation 7

Same name and namespace in other branches
  1. 8 tests/exif_orientation.test \ExifOrientationTest::testUserPicture()

Test auto rotation of uploaded user profile pictures.

File

tests/exif_orientation.test, line 46
Tests for exif_orientation.module.

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);
}