diff --git a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php index 56dcf70..508a1cd 100644 --- a/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php +++ b/core/modules/image/src/Plugin/ImageEffect/ScaleAndCropImageEffect.php @@ -38,10 +38,8 @@ public function applyEffect(ImageInterface $image) { */ public function transformDimensions(array &$dimensions, $uri) { if (isset($dimensions['width'], $dimensions['height'])) { - $is_scaled = Image::scaleDimensions($dimensions, $this->configuration['width'], $this->configuration['height'], $this->configuration['upscale']); - // If image is not scaled save the original dimensions. - if (!$is_scaled) { + if (!Image::scaleDimensions($dimensions, $this->configuration['width'], $this->configuration['height'], $this->configuration['upscale'])) { return; } } @@ -62,9 +60,9 @@ public function getSummary() { * {@inheritdoc} */ public function defaultConfiguration() { - $configuration = parent::defaultConfiguration(); - $configuration['upscale'] = FALSE; - return $configuration; + return [ + 'upscale' => FALSE, + ] + parent::defaultConfiguration(); } /** diff --git a/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php b/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php index 20ab890..fb5b0dc 100644 --- a/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php +++ b/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php @@ -35,8 +35,12 @@ public function testImagePostUpdateScaleAndCropEffectUpscale() { // Test that Scale and crop effect has 'upscale' parameter set. $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']); + if (array_key_exists('upscale', $effect_data)) { + $this->assertFalse($effect_data['upscale']); + } + else { + $this->fail("Confirming that 'upscale' parameter is updated properly"); + } } }