$this->
drupalGet($style_path);
$this->
submitForm($edit, 'Save'
);
// Note that after changing the style name, the style path is changed.
$style_path = 'admin/config/media/image-styles/manage/' .
$style_name;
// Check that the URL was updated.
$this->
drupalGet($style_path);
$this->
assertSession()->
titleEquals("Edit style
$style_label | Drupal"
);
// Check that the available image effects are properly sorted.
$option =
$this->
assertSession()->
selectExists('edit-new--2'
)->
findAll('css', 'option'
);
$this->
assertEquals('Ajax test',
$option[1
]->
getText(), '"Ajax test" is the first selectable effect.'
);
// Check that the image was flushed after updating the style.
// This is especially important when renaming the style. Make sure that
// the old image directory has been deleted.
$this->
assertEquals(0,
$this->
getImageCount($style),
new FormattableMarkup('Image style %style was flushed after renaming the style and updating the order of effects.',
['%style' =>
$style->
label()]));
// Load the style by the new name with the new weights.
$style = ImageStyle::
load($style_name);
// Confirm the new style order was saved.