function MediaSourceTest::testHiddenSourceField
Same name in other branches
- 9 core/modules/media/tests/src/Kernel/MediaSourceTest.php \Drupal\Tests\media\Kernel\MediaSourceTest::testHiddenSourceField()
- 10 core/modules/media/tests/src/Kernel/MediaSourceTest.php \Drupal\Tests\media\Kernel\MediaSourceTest::testHiddenSourceField()
- 11.x core/modules/media/tests/src/Kernel/MediaSourceTest.php \Drupal\Tests\media\Kernel\MediaSourceTest::testHiddenSourceField()
Tests hidden source field in media type.
File
-
core/
modules/ media/ tests/ src/ Kernel/ MediaSourceTest.php, line 551
Class
- MediaSourceTest
- Tests media source plugins related logic.
Namespace
Drupal\Tests\media\KernelCode
public function testHiddenSourceField() {
$id = 'test_hidden_source_field';
$field_name = 'field_media_hidden';
$this->createMediaTypeViaForm($id, $field_name);
// Source field not in displays.
$display = \Drupal::service('entity_display.repository')->getViewDisplay('media', $id);
$this->assertArrayNotHasKey($field_name, $display->getComponents());
$display = \Drupal::service('entity_display.repository')->getFormDisplay('media', $id);
$this->assertArrayNotHasKey($field_name, $display->getComponents());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.