summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-09-26 14:58:36 (GMT)
committerAlex Pott2015-09-26 14:58:36 (GMT)
commit1c385292872f1a6f6ba8b5a6894f4c58a402a2a0 (patch)
treeed2ecc5afa046af0f5b52131be3a1ee265d22d40
parentd59b87995e03b526a6c5a4ffae71d56b7a94316a (diff)
Issue #2573221 by Jelle_S: Keyed mapping static cache is not rebuilt when overwriting an existing mapping
-rw-r--r--core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php1
-rw-r--r--core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php13
2 files changed, 14 insertions, 0 deletions
diff --git a/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php b/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php
index f3a2084..f585bc2 100644
--- a/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php
+++ b/core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php
@@ -112,6 +112,7 @@ class ResponsiveImageStyle extends ConfigEntityBase implements ResponsiveImageSt
'breakpoint_id' => $breakpoint_id,
'multiplier' => $multiplier,
) + $image_style_mapping;
+ $this->keyedImageStyleMappings = NULL;
return $this;
}
}
diff --git a/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php b/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php
index 63580a8..71e81ed 100644
--- a/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php
+++ b/core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php
@@ -252,6 +252,19 @@ class ResponsiveImageStyleConfigEntityUnitTest extends UnitTestCase {
'image_mapping' => 'medium',
);
$this->assertEquals($expected, $entity->getKeyedImageStyleMappings());
+
+ // Overwrite a mapping to ensure keyed mapping static cache is rebuilt.
+ $entity->addImageStyleMapping('test_breakpoint2', '2x', array(
+ 'image_mapping_type' => 'image_style',
+ 'image_mapping' => 'large',
+ ));
+ $expected['test_breakpoint2']['2x'] = array(
+ 'breakpoint_id' => 'test_breakpoint2',
+ 'multiplier' => '2x',
+ 'image_mapping_type' => 'image_style',
+ 'image_mapping' => 'large',
+ );
+ $this->assertEquals($expected, $entity->getKeyedImageStyleMappings());
}
/**