public function MediaTypeTest::testCloneMediaInLibraryField in Lightning Media 8.4
Same name and namespace in other branches
- 8 tests/src/Kernel/MediaTypeTest.php \Drupal\Tests\lightning_media\Kernel\MediaTypeTest::testCloneMediaInLibraryField()
- 8.2 tests/src/Kernel/MediaTypeTest.php \Drupal\Tests\lightning_media\Kernel\MediaTypeTest::testCloneMediaInLibraryField()
- 8.3 tests/src/Kernel/MediaTypeTest.php \Drupal\Tests\lightning_media\Kernel\MediaTypeTest::testCloneMediaInLibraryField()
Tests that field_media_in_library is auto-cloned for new media bundles.
File
- tests/
src/ Kernel/ MediaTypeTest.php, line 45
Class
- MediaTypeTest
- Tests of API-level Lightning functionality related to media types.
Namespace
Drupal\Tests\lightning_media\KernelCode
public function testCloneMediaInLibraryField() {
$type = $this
->createMediaType('file')
->id();
/** @var \Drupal\media\MediaInterface $media */
$media = $this->container
->get('entity_type.manager')
->getStorage('media')
->create([
'bundle' => $type,
]);
$this
->assertTrue($media
->hasField('field_media_in_library'));
// The field should be present in the form as a checkbox.
$component = $this->container
->get('entity_display.repository')
->getFormDisplay('media', $type)
->getComponent('field_media_in_library');
$this
->assertIsArray($component);
}