MediaTypeTest.php in Lightning Media 8
File
tests/src/Kernel/MediaTypeTest.php
View source
<?php
namespace Drupal\Tests\lightning_media\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\lightning_core\ConfigHelper as Config;
use Drupal\Tests\media\Functional\MediaFunctionalTestCreateMediaTypeTrait;
class MediaTypeTest extends KernelTestBase {
use MediaFunctionalTestCreateMediaTypeTrait;
protected static $modules = [
'field',
'file',
'image',
'lightning_core',
'lightning_media',
'media',
'user',
];
public function setUp() {
parent::setUp();
Config::forModule('lightning_media')
->getEntity('field_storage_config', 'media.field_media_in_library')
->save();
}
public function testCloneMediaInLibraryField() {
$type = $this
->createMediaType([], 'file')
->id();
$media = $this->container
->get('entity_type.manager')
->getStorage('media')
->create([
'bundle' => $type,
]);
$this
->assertTrue($media
->hasField('field_media_in_library'));
$component = entity_get_form_display('media', $type, 'default')
->getComponent('field_media_in_library');
$this
->assertInternalType('array', $component);
}
}
Classes
Name |
Description |
MediaTypeTest |
Tests of API-level Lightning functionality related to media types. |