Tests embedded users on node pages.
function testPictureOnNodeComment() {
$this
->drupalLogin($this->web_user);
// Save a new picture.
$image = current($this
->drupalGetTestFiles('image'));
$file = $this
->saveUserPicture($image);
$node = $this
->drupalCreateNode(array(
'type' => 'article',
));
// Enable user pictures on nodes.
$this->container
->get('config.factory')
->get('system.theme.global')
->set('features.node_user_picture', TRUE)
->save();
// Verify that the image is displayed on the user account page.
$this
->drupalGet('node/' . $node->nid);
$this
->assertRaw(file_uri_target($file->uri), 'User picture found on node page.');
// Enable user pictures on comments, instead of nodes.
$this->container
->get('config.factory')
->get('system.theme.global')
->set('features.node_user_picture', FALSE)
->set('features.comment_user_picture', TRUE)
->save();
$edit = array(
'comment_body[' . Language::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this
->randomString(),
);
$this
->drupalPost('comment/reply/' . $node->nid, $edit, t('Save'));
$this
->assertRaw(file_uri_target($file->uri), 'User picture found on comment.');
// Disable user pictures on comments and nodes.
$this->container
->get('config.factory')
->get('system.theme.global')
->set('features.node_user_picture', FALSE)
->set('features.comment_user_picture', FALSE)
->save();
$this
->drupalGet('node/' . $node->nid);
$this
->assertNoRaw(file_uri_target($file->uri), 'User picture not found on node and comment.');
}