Issue #3106659 by phenaproxima, aleevas, rajanvalecha12, Drupaldev2013, audacus, mulukallaarun, Kristen Pol, dpi: Media types with missing source fields break the status report page
parent
26c10ba29f
commit
b2686e3d18
|
@ -135,7 +135,7 @@ function media_requirements($phase) {
|
|||
->getViewDisplay('media', $type->id());
|
||||
|
||||
$source_field_definition = $type->getSource()->getSourceFieldDefinition($type);
|
||||
if (!is_a($source_field_definition->getItemDefinition()->getClass(), ImageItem::class, TRUE)) {
|
||||
if (empty($source_field_definition) || !is_a($source_field_definition->getItemDefinition()->getClass(), ImageItem::class, TRUE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\media\Functional;
|
||||
|
||||
/**
|
||||
* Tests the Media module's requirements checks.
|
||||
*
|
||||
* @group media
|
||||
*/
|
||||
class MediaRequirementsTest extends MediaFunctionalTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $defaultTheme = 'stark';
|
||||
|
||||
/**
|
||||
* Tests that the requirements check can handle a missing source field.
|
||||
*/
|
||||
public function testMissingSourceFieldDefinition() {
|
||||
$media_type = $this->createMediaType('test');
|
||||
/** @var \Drupal\field\FieldConfigInterface $field_definition */
|
||||
$field_definition = $media_type->getSource()
|
||||
->getSourceFieldDefinition($media_type);
|
||||
/** @var \Drupal\field\FieldStorageConfigInterface $field_storage_definition */
|
||||
$field_storage_definition = $field_definition->getFieldStorageDefinition();
|
||||
$field_definition->delete();
|
||||
$field_storage_definition->delete();
|
||||
|
||||
$this->drupalLogin($this->rootUser);
|
||||
$this->drupalGet('/admin/reports/status');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue