You are here

protected function MissingEntityReferenceTest::getEntitiesDataArray in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/tests/src/Functional/MissingEntityReferenceTest.php \Drupal\Tests\entity_share_client\Functional\MissingEntityReferenceTest::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/MissingEntityReferenceTest.php, line 71

Class

MissingEntityReferenceTest
Functional test class for entity reference field with missing entity.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function getEntitiesDataArray() {
  return [
    'taxonomy_term' => [
      'en' => [
        'es_test_tag' => $this
          ->getCompleteTaxonomyTermInfos([
          'vid' => [
            'value' => 'es_test',
          ],
        ]),
        'es_test_tag_2' => $this
          ->getCompleteTaxonomyTermInfos([
          'vid' => [
            'value' => 'es_test',
          ],
        ]),
      ],
    ],
    'node' => [
      'en' => [
        'es_test_content_reference' => $this
          ->getCompleteNodeInfos([
          // Single value field.
          'field_es_test_content_reference' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('node', 'es_test_to_be_deleted'),
                ],
              ];
            },
          ],
          // Multiple value field.
          'field_es_test_taxonomy' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('taxonomy_term', 'es_test_tag'),
                ],
                [
                  'target_id' => $this
                    ->getEntityId('taxonomy_term', 'es_test_tag_deleted'),
                ],
                [
                  'target_id' => $this
                    ->getEntityId('taxonomy_term', 'es_test_tag_2'),
                ],
              ];
            },
          ],
        ]),
      ],
    ],
  ];
}