diff --git a/core/modules/image/src/Tests/ImageAdminStylesTest.php b/core/modules/image/src/Tests/ImageAdminStylesTest.php index d998883..5487078 100644 --- a/core/modules/image/src/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php @@ -124,6 +124,12 @@ function testStyle() { // Load the saved image style. $style = entity_load('image_style', $style_name); + + // Ensure that third party settings were added to the config entity. + // These are added by a hook_image_style_presave() implemented in + // image_module_test module. + $this->assertEqual('bar', $style->getThirdPartySetting('image_module_test', 'foo'), 'Third party settings were added to the image style.'); + // Ensure that the image style URI matches our expected path. $style_uri_path = $style->url(); $this->assertTrue(strpos($style_uri_path, $style_path) !== FALSE, 'The image style URI is correct.'); diff --git a/core/modules/image/src/Tests/ImageFieldTestBase.php b/core/modules/image/src/Tests/ImageFieldTestBase.php index 561737a..64b912e 100644 --- a/core/modules/image/src/Tests/ImageFieldTestBase.php +++ b/core/modules/image/src/Tests/ImageFieldTestBase.php @@ -32,7 +32,7 @@ * * @var array */ - public static $modules = array('node', 'image', 'field_ui'); + public static $modules = array('node', 'image', 'field_ui', 'image_module_test'); protected $admin_user; diff --git a/core/modules/image/tests/modules/image_module_test/config/schema/image_module_test.schema.yml b/core/modules/image/tests/modules/image_module_test/config/schema/image_module_test.schema.yml new file mode 100644 index 0000000..a36719d --- /dev/null +++ b/core/modules/image/tests/modules/image_module_test/config/schema/image_module_test.schema.yml @@ -0,0 +1,7 @@ +image_style.third_party.image_module_test: + type: mapping + label: 'Schema for image_module_test module additions to image_style entity' + mapping: + foo: + type: string + label: 'Label for foo' diff --git a/core/modules/image/tests/modules/image_module_test/image_module_test.module b/core/modules/image/tests/modules/image_module_test/image_module_test.module index 0242f1e..df71375 100644 --- a/core/modules/image/tests/modules/image_module_test/image_module_test.module +++ b/core/modules/image/tests/modules/image_module_test/image_module_test.module @@ -5,6 +5,8 @@ * Provides Image module hook implementations for testing purposes. */ +use Drupal\image\ImageStyleInterface; + function image_module_test_file_download($uri) { $default_uri = \Drupal::state()->get('image.test_file_download') ?: FALSE; if ($default_uri == $uri) { @@ -21,3 +23,12 @@ function image_module_test_image_effect_info_alter(&$effects) { $image_effects_definition_called = &drupal_static(__FUNCTION__, 0); $image_effects_definition_called++; } + +/** + * Implements hook_image_style_presave(). + * + * Used to save test third party settings in the image style entity. + */ +function image_module_test_image_style_presave(ImageStyleInterface $style) { + $style->setThirdPartySetting('image_module_test', 'foo', 'bar'); +}