// Test theme function for responsive image, but using the test formatter.
$display_options =
[ 'type' => 'responsive_image_test',
'settings' =>
[ 'image_link' => 'file',
'responsive_image_style' => 'style_one',
],
];
/** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
$display_repository = \Drupal::
service('entity_display.repository'
);
$display =
$display_repository->
getViewDisplay('node', 'article'
);
$display->
setComponent($field_name,
$display_options) ->
save();
$this->
drupalGet('node/' .
$nid);
// Use the responsive image formatter linked to file formatter.
$display_options =
[ 'type' => 'responsive_image',
'settings' =>
[ 'image_link' => 'file',
'responsive_image_style' => 'style_one',
],