public function MediaSourceTest::testHiddenSourceField in Drupal 9
Same name and namespace in other branches
- 8 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()
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());
}