protected function MediaEntityReferenceTest::getEntitiesDataArray in Entity Share 8.3
Same name and namespace in other branches
- 8.2 modules/entity_share_client/tests/src/Functional/MediaEntityReferenceTest.php \Drupal\Tests\entity_share_client\Functional\MediaEntityReferenceTest::getEntitiesDataArray()
Helper function to get a mapping of the entities data.
Used to create the entities for the test and to test that it has been recreated properly.
Overrides EntityShareClientFunctionalTestBase::getEntitiesDataArray
File
- modules/
entity_share_client/ tests/ src/ Functional/ MediaEntityReferenceTest.php, line 122
Class
- MediaEntityReferenceTest
- Functional test class for media entity reference field.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function getEntitiesDataArray() {
return [
'file' => [
'en' => $this
->preparePhysicalFilesAndFileEntitiesData(),
],
'media' => [
'en' => [
'es_test_audio' => $this
->getCompleteMediaInfos([
'field_es_test_audio_file' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'file_audio'),
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'bundle' => [
'value' => 'es_test_audio',
'checker_callback' => 'getTargetId',
],
]),
'es_test_document' => $this
->getCompleteMediaInfos([
'field_es_test_document' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'file_document'),
'display' => 1,
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'bundle' => [
'value' => 'es_test_document',
'checker_callback' => 'getTargetId',
],
]),
'es_test_image' => $this
->getCompleteMediaInfos([
'field_es_test_image' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'file_image'),
// Can't use faker because it is a value_callback to handle
// the target_id.
'alt' => 'Alt text',
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'bundle' => [
'value' => 'es_test_image',
'checker_callback' => 'getTargetId',
],
]),
'es_test_remote_video' => $this
->getCompleteMediaInfos([
'field_es_test_oembed_video' => [
'value' => 'https://www.youtube.com/watch?v=Apqd4ff0NRI',
'checker_callback' => 'getValue',
],
'bundle' => [
'value' => 'es_test_remote_video',
'checker_callback' => 'getTargetId',
],
]),
'es_test_video' => $this
->getCompleteMediaInfos([
'field_es_test_video_file' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'file_video'),
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'bundle' => [
'value' => 'es_test_video',
'checker_callback' => 'getTargetId',
],
]),
],
],
'node' => [
'en' => [
'es_test_media' => $this
->getCompleteNodeInfos([
'field_es_test_media' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('media', 'es_test_audio'),
],
[
'target_id' => $this
->getEntityId('media', 'es_test_document'),
],
[
'target_id' => $this
->getEntityId('media', 'es_test_image'),
],
[
'target_id' => $this
->getEntityId('media', 'es_test_remote_video'),
],
[
'target_id' => $this
->getEntityId('media', 'es_test_video'),
],
];
},
'checker_callback' => 'getExpectedMediaReferenceValue',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
],
],
];
}