You are here

protected function TaxonomyEntityReferenceTest::getEntitiesDataArray in Entity Share 8.2

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

Class

TaxonomyEntityReferenceTest
Functional test class for taxonomy entity reference field.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function getEntitiesDataArray() {
  return [
    'taxonomy_term' => [
      'en' => [
        'parent_tag' => $this
          ->getCompleteTaxonomyTermInfos([]),
        'child_tag' => $this
          ->getCompleteTaxonomyTermInfos([
          'parent' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('taxonomy_term', 'parent_tag'),
                ],
              ];
            },
            'checker_callback' => 'getExpectedTaxonomyParentReferenceValue',
          ],
        ]),
      ],
    ],
    'node' => [
      'en' => [
        'es_test_taxonomy_reference' => $this
          ->getCompleteNodeInfos([
          'type' => [
            'value' => 'es_test',
            'checker_callback' => 'getTargetId',
          ],
          'field_es_test_taxonomy' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('taxonomy_term', 'child_tag'),
                ],
              ];
            },
            'checker_callback' => 'getExpectedTaxonomyReferenceValue',
          ],
        ]),
      ],
    ],
  ];
}