diff --git a/core/modules/image/image.post_update.php b/core/modules/image/image.post_update.php index 316d511..2355b4f 100644 --- a/core/modules/image/image.post_update.php +++ b/core/modules/image/image.post_update.php @@ -32,18 +32,13 @@ function image_post_update_image_style_dependencies() { */ function image_post_update_scale_and_crop_effect_upscale() { foreach (ImageStyle::loadMultiple() as $image_style) { - $edited = FALSE; foreach ($image_style->getEffects() as $effect) { if ($effect->getPluginId() === 'image_scale_and_crop') { - $configuration = $effect->getConfiguration(); - $configuration['data']['upscale'] = FALSE; - $effect->setConfiguration($configuration); - $edited = TRUE; + $image_style->save(); + break; + } } - if ($edited) { - $image_style->save(); - } } } diff --git a/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php b/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php index c054911..deda666 100644 --- a/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php +++ b/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php @@ -10,7 +10,7 @@ * * @see image_post_update_scale_and_crop_effect_upscale() * - * @group Update + * @group image */ class ScaleAndCropUpscaleUpdateTest extends UpdatePathTestBase { @@ -28,18 +28,16 @@ protected function setDatabaseDumpFiles() { * Tests that 'upscale' parameter is updated properly. */ public function testImagePostUpdateScaleAndCropEffectUpscale() { - $image_style = ImageStyle::load('test_scale_and_crop_upscale'); // Test that Scale and crop effect does not have 'upscale' parameter set. - $effect = $image_style->getEffect('637b75a0-a80a-4bcc-8300-66994a27871d'); - $this->assertFalse(isset($effect->getConfiguration()['data']['upscale'])); + $effect_data = $this->config('image.style.test_scale_and_crop_upscale')->get('effects.637b75a0-a80a-4bcc-8300-66994a27871d.data'); + $this->assertFalse(array_key_exists('upscale', $effect_data)); $this->runUpdates(); - $image_style = ImageStyle::load('test_scale_and_crop_upscale'); // Test that Scale and crop effect has 'upscale' parameter set. - $effect = $image_style->getEffect('637b75a0-a80a-4bcc-8300-66994a27871d'); - $this->assertTrue(isset($effect->getConfiguration()['data']['upscale'])); - $this->assertFalse($effect->getConfiguration()['data']['upscale']); + $effect_data = $this->config('image.style.test_scale_and_crop_upscale')->get('effects.637b75a0-a80a-4bcc-8300-66994a27871d.data'); + $this->assertTrue(array_key_exists('upscale', $effect_data)); + $this->assertFalse($effect_data['upscale']); } }