public function MediaTypeTest::testCloneMediaInLibraryField in Lightning Media 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/MediaTypeTest.php \Drupal\Tests\lightning_media\Kernel\MediaTypeTest::testCloneMediaInLibraryField()
- 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()
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 = lightning_media_entity_get_form_display('media', $type)
->getComponent('field_media_in_library');
$this
->assertSame('array', gettype($component));
}