function UserPictureTestCase::testExternalPicture
Test HTTP schema working with user pictures.
File
-
modules/
user/ user.test, line 1518
Class
Code
function testExternalPicture() {
$this->drupalLogin($this->user);
// Set the default picture to an URI with a HTTP schema.
$images = $this->drupalGetTestFiles('image');
$image = $images[0];
$pic_path = file_create_url($image->uri);
variable_set('user_picture_default', $pic_path);
// Check if image is displayed in user's profile page.
$this->drupalGet('user');
// Get the user picture image via xpath.
$elements = $this->xpath('//div[@class="user-picture"]/img');
$this->assertEqual(count($elements), 1, "There is exactly one user picture on the user's profile page");
$this->assertEqual($pic_path, (string) $elements[0]['src'], "User picture source is correct.");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.