// Image effect deletion form.
// Create an image to make sure it gets flushed after deleting an effect.
$image_path =
$this->
createSampleImage($style);
$this->
assertEquals(1,
$this->
getImageCount($style),
new FormattableMarkup('Image style %style image %file successfully generated.',
['%style' =>
$style->
label(), '%file' =>
$image_path]));
// Delete the 'image_crop' effect from the style.
$this->
drupalGet($style_path . '/effects/' .
$uuids['image_crop'
] . '/delete'
);
$this->
submitForm([], 'Delete'
);
// Confirm that the form submission was successful.
$this->
assertSession()->
statusCodeEquals(200
);
$image_crop_effect =
$style->
getEffect($uuids['image_crop'
]);
$this->
assertSession()->
statusMessageContains("The image effect {
$image_crop_effect->
label()} has been deleted.", 'status'
);
// Confirm that there is no longer a link to the effect.
$this->
assertSession()->
linkByHrefNotExists($style_path . '/effects/' .
$uuids['image_crop'
] . '/delete'
);
// Refresh the image style information and verify that the effect was
// actually deleted.
$entity_type_manager =
$this->container->
get('entity_type.manager'
);
$style =
$entity_type_manager->
getStorage('image_style'
)->
loadUnchanged($style->
id());
$this->
assertFalse($style->
getEffects()->
has($uuids['image_crop'
]),
new FormattableMarkup( 'Effect with ID %uuid no longer found on image style %style',
[ '%uuid' =>
$uuids['image_crop'
],