Test if processor if set in config
Closes #3241146
Merge request reports
Activity
92 92 '#responsive_image_style_id' => $this->imageStyle->id(), 93 93 ]; 94 94 95 $this->container->get('config.factory')->getEditable('avif.settings')->set('processor', 'imagemagick')->save(); 96 - Comment on lines +95 to +96
We should adjust this test to use a data provider with the image processor. There is a test module with a dummy processor we can use instead of imagemagick. I think we just need two options,
NULL
and'avif_test'
. The data provider should also specify the expected number of avif and jpeg images. That way we can test that there is no avif in the markup when the processor isNULL
and there is one avif in the markup when the processor is'avif_test'
.
31 31 function avif_preprocess_responsive_image(&$variables) { 32 32 $avif_sources = []; 33 33 34 if (!isset($variables['sources'])) { 34 $avifProcessor = \Drupal::configFactory()->getEditable('avif.settings')->get('processor'); 35 36 if (!isset($variables['sources']) || !$avifProcessor) { - Comment on lines -34 to +36
I think we need to test more than just the config value is not empty. We should call
\Drupal::service('plugin.manager.avif_processor')->getDefinition($pluginId)
and ensure it's an instanceofAvifProcessorInterface
. That will ensure we don't have a bogus config value, e.g. if you uninstall a module that was previously providing the processor.In fact we should add another case to the data provider for a random string in the config value.
changed this line in version 6 of the diff
added 2 commits
added 1 commit