You are here

protected function MissingFieldsTest::getEntitiesDataArray in Entity Share 8.3

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/MissingFieldsTest.php, line 51

Class

MissingFieldsTest
Functional test class for non-existing fields on client website.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function getEntitiesDataArray() {
  return [
    'taxonomy_term' => [
      'en' => [
        'es_test_tag' => $this
          ->getCompleteTaxonomyTermInfos([
          'vid' => [
            'value' => 'es_test',
          ],
        ]),
      ],
    ],
    'node' => [
      'en' => [
        'es_test_missing_fields' => $this
          ->getCompleteNodeInfos([
          // Basic field.
          'field_es_test_text_plain_long' => [
            'value' => $this->faker
              ->text(1000),
            'checker_callback' => 'getValue',
          ],
          // Entity reference field.
          'field_es_test_taxonomy' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('taxonomy_term', 'es_test_tag'),
                ],
              ];
            },
          ],
        ]),
      ],
      'fr' => [
        'es_test_missing_fields' => $this
          ->getCompleteNodeInfos([
          // Text: plain, long.
          'field_es_test_text_plain_long' => [
            'value' => $this->faker
              ->text(1000),
            'checker_callback' => 'getValue',
          ],
          // Multiple value field.
          'field_es_test_taxonomy' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('taxonomy_term', 'es_test_tag'),
                ],
              ];
            },
          ],
        ]),
      ],
    ],
  ];
}