protected function FileTest::getEntitiesDataArray in Entity Share 8.3
Same name and namespace in other branches
- 8.2 modules/entity_share_client/tests/src/Functional/FileTest.php \Drupal\Tests\entity_share_client\Functional\FileTest::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
1 method overrides FileTest::getEntitiesDataArray()
- FileDeletedTest::getEntitiesDataArray in modules/
entity_share_client/ tests/ src/ Functional/ FileDeletedTest.php - Helper function to get a mapping of the entities data.
File
- modules/
entity_share_client/ tests/ src/ Functional/ FileTest.php, line 130
Class
- FileTest
- Functional test class for file field.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function getEntitiesDataArray() {
return [
'file' => [
'en' => $this
->preparePhysicalFilesAndFileEntitiesData(),
],
'node' => [
'en' => [
// Basic public file.
'es_test_public_file' => $this
->getCompleteNodeInfos([
'field_es_test_file' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_file'),
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// Public file with hidden description.
'es_test_public_file_description_hidden' => $this
->getCompleteNodeInfos([
'field_es_test_file' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_file'),
'display' => 0,
// Can't use faker because it is a value_callback to handle
// the target_id.
'description' => 'Description 1',
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// Public file with shown description.
'es_test_public_file_description_shown' => $this
->getCompleteNodeInfos([
'field_es_test_file' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_file'),
'display' => 1,
// Can't use faker because it is a value_callback to handle
// the target_id.
'description' => 'Description 2',
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// Public file in sub-directory.
'es_test_public_file_sub_directory' => $this
->getCompleteNodeInfos([
'field_es_test_file' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_file_sub_directory'),
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// Private file in sub-directory.
'es_test_private_file_sub_directory' => $this
->getCompleteNodeInfos([
'field_es_test_file' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'private_file_sub_directory'),
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// PNG.
'es_test_png' => $this
->getCompleteNodeInfos([
'field_es_test_image' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_png'),
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// JPEG + alt text.
'es_test_jpeg_alt' => $this
->getCompleteNodeInfos([
'field_es_test_image' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_jpg'),
// Can't use faker because it is a value_callback to handle
// the target_id.
'alt' => 'Alt text 1',
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// JPEG + title text.
'es_test_jpeg_title' => $this
->getCompleteNodeInfos([
'field_es_test_image' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_jpg'),
// Can't use faker because it is a value_callback to handle
// the target_id.
'title' => 'Title text 1',
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// JPEG + alt text + title text.
'es_test_jpeg_alt_title' => $this
->getCompleteNodeInfos([
'field_es_test_image' => [
'value_callback' => function () {
return [
[
'target_id' => $this
->getEntityId('file', 'public_jpg'),
// Can't use faker because it is a value_callback to handle
// the target_id.
'alt' => 'Alt text 2',
'title' => 'Title text 2',
],
];
},
'checker_callback' => 'getFilteredStructureValues',
],
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
],
],
];
}