|
|
@ -10,6 +10,11 @@ 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 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -26,15 +31,16 @@ 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); |
|
|
|
$this->createEntityReferenceField('media', $testImageMediaType->id(), 'field_media_of', 'Media Of', 'node', 'default', [], 2);("Got past create media type."); |
|
|
|
|
|
|
|
|
|
|
|
// 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' => NULL,*/ 'image_link' => 'content'], |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$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') |
|
|
@ -47,7 +53,6 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase { |
|
|
|
'title' => 'Test Node', |
|
|
|
'title' => 'Test Node', |
|
|
|
]); |
|
|
|
]); |
|
|
|
$node->save(); |
|
|
|
$node->save(); |
|
|
|
|
|
|
|
|
|
|
|
// Make a image for the Media. |
|
|
|
// Make a image for the Media. |
|
|
|
$file = $this->container->get('entity_type.manager')->getStorage('file')->create([ |
|
|
|
$file = $this->container->get('entity_type.manager')->getStorage('file')->create([ |
|
|
|
'uid' => $account->id(), |
|
|
|
'uid' => $account->id(), |
|
|
|