$this->
drupalLogin($this->adminUser
);
} // Use the responsive image formatter with a responsive image style.
$display_options['settings'
]['responsive_image_style'
] = 'style_one';
$display_options['settings'
]['image_link'
] = '';
$display->
setComponent($field_name,
$display_options) ->
save();
// Create a derivative so at least one MIME type will be known.
$large_style = ImageStyle::
load('large'
);
$large_style->
createDerivative($image_uri,
$large_style->
buildUri($image_uri));
// Output should contain all image styles and all breakpoints.
$this->
drupalGet('node/' .
$nid);
if (!
$empty_styles) { $this->
assertSession()->
responseContains('/styles/medium/'
);
// Assert the empty image is present.
$this->
assertSession()->
responseContains('data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='
);
$thumbnail_style = ImageStyle::
load('thumbnail'
);
// Assert the output of the 'srcset' attribute (small multipliers first).
$this->
assertSession()->
responseContains('data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== 1x, ' .
$this->fileUrlGenerator->
transformRelative($thumbnail_style->
buildUrl($image_uri)) . ' 1.5x'
);
$this->
assertSession()->
responseContains('/styles/medium/'
);