MediaTypeTest.php in Lightning Media 8.4
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\Traits\MediaTypeCreationTrait;
class MediaTypeTest extends KernelTestBase {
use MediaTypeCreationTrait;
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 = $this->container
->get('entity_display.repository')
->getFormDisplay('media', $type)
->getComponent('field_media_in_library');
$this
->assertIsArray($component);
}
}
Classes
Name |
Description |
MediaTypeTest |
Tests of API-level Lightning functionality related to media types. |