Browse Source

Update islandora_image schema to fix failing test.

pull/869/head
Alexander O'Neill 3 years ago
parent
commit
11bc7886ea
  1. 8
      config/schema/islandora.schema.yml
  2. 16
      tests/src/Functional/IslandoraImageFormatterTest.php

8
config/schema/islandora.schema.yml

@ -169,3 +169,11 @@ field.formatter.settings.islandora_image:
image_style: image_style:
type: string type: string
label: 'Image style' label: 'Image style'
image_loading:
type: mapping
label: 'Image loading settings'
mapping:
attribute:
type: string
label: 'Loading attribute'

16
tests/src/Functional/IslandoraImageFormatterTest.php

@ -10,11 +10,6 @@ namespace Drupal\Tests\islandora\Functional;
*/ */
class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase { class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase {
/**
* @var bool Suppresses "Schema incomplete" error.
*/
protected $strictConfigSchema = FALSE;
/** /**
* @covers \Drupal\islandora\Plugin\Field\FieldFormatter\IslandoraImageFormatter::viewElements * @covers \Drupal\islandora\Plugin\Field\FieldFormatter\IslandoraImageFormatter::viewElements
*/ */
@ -31,16 +26,21 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase {
// Create an image media type. // Create an image media type.
$testImageMediaType = $this->createMediaType('image', ['id' => 'test_image_media_type']); $testImageMediaType = $this->createMediaType('image', ['id' => 'test_image_media_type']);
$testImageMediaType->save(); $testImageMediaType->save();
$this->createEntityReferenceField('media', $testImageMediaType->id(), 'field_media_of', 'Media Of', 'node', 'default', [], 2);("Got past create media type."); $this->createEntityReferenceField('media', $testImageMediaType->id(), 'field_media_of', 'Media Of', 'node', 'default', [], 2);
// Set the display mode to use the islandora_image formatter. // Set the display mode to use the islandora_image formatter.
// Also, only show the image on display to remove clutter. // Also, only show the image on display to remove clutter.
$display_options = [ $display_options = [
'type' => 'islandora_image', 'type' => 'islandora_image',
'settings' => [/*'image_style' => NULL,*/ 'image_link' => 'content'], 'settings' => [
'image_style' => '',
'image_link' => 'content',
'image_loading' => [
'attribute' => 'eager',
],
],
]; ];
$display = $this->container->get('entity_display.repository')->getViewDisplay('media', $testImageMediaType->id(), 'default'); $display = $this->container->get('entity_display.repository')->getViewDisplay('media', $testImageMediaType->id(), 'default');
$display->setComponent('field_media_image', $display_options) $display->setComponent('field_media_image', $display_options)
->removeComponent('created') ->removeComponent('created')
->removeComponent('uid') ->removeComponent('uid')

Loading…
Cancel
Save