// Set an arbitrary metadata value to be mapped.
$this->container->
get('state'
) ->
set('media_source_test_attributes',
[ 'attribute_to_map' =>
[ 'title' => 'Attribute to map',
'value' => 'Snowball',
],
'thumbnail_uri' =>
[ 'value' => 'public://TheSisko.png',
],
]);
$this->testMediaType->
setFieldMap([ 'attribute_to_map' => 'field_to_map_to',
])->
save();
/** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
$storage =
$this->container->
get('entity_type.manager'
) ->
getStorage('media'
);
/** @var \Drupal\media\MediaInterface $a */
$a =
$storage->
create([ 'bundle' =>
$this->testMediaType->
id(),
]);