/**
* Tests the getSourceFieldValue() method.
*/
public function testGetSourceFieldValue() { /** @var \Drupal\media\MediaInterface $media */
$media = Media::
create([ 'bundle' =>
$this->testMediaType->
id(),
'field_media_test' => 'some_value',
]);
$media->
save();
$media_source =
$media->
getSource();
$this->
assertSame('some_value',
$media_source->
getSourceFieldValue($media));
// Test that NULL is returned if there is no value in the source field.
$media->
set('field_media_test', NULL
)->
save();
$this->
assertNull($media_source->
getSourceFieldValue($media));
} /**
* Tests the thumbnail functionality.
*/
public function testThumbnail() { file_put_contents('public://thumbnail1.jpg', ''
);