You are here

protected function ContentEntityReferenceTest::getEntitiesDataArray in Entity Share 8.3

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

Class

ContentEntityReferenceTest
Functional test class for content entity reference field.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function getEntitiesDataArray() {
  return [
    'node' => [
      'en' => [
        // Used for internal reference.
        'es_test_level_3' => $this
          ->getCompleteNodeInfos([
          'status' => [
            'value' => NodeInterface::PUBLISHED,
            'checker_callback' => 'getValue',
          ],
        ]),
        // Content reference.
        'es_test_level_2' => $this
          ->getCompleteNodeInfos([
          'field_es_test_content_reference' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('node', 'es_test_level_3'),
                ],
              ];
            },
            'checker_callback' => 'getExpectedContentReferenceValue',
          ],
        ]),
        // Content reference.
        'es_test_level_1' => $this
          ->getCompleteNodeInfos([
          'field_es_test_content_reference' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('node', 'es_test_level_2'),
                ],
              ];
            },
            'checker_callback' => 'getExpectedContentReferenceValue',
          ],
        ]),
        // Content reference.
        'es_test_level_0' => $this
          ->getCompleteNodeInfos([
          'field_es_test_content_reference' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('node', 'es_test_level_1'),
                ],
              ];
            },
            'checker_callback' => 'getExpectedContentReferenceValue',
          ],
        ]),
      ],
    ],
  ];
}