You are here

protected function ParagraphTest::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/ParagraphTest.php, line 81

Class

ParagraphTest
Functional test class for paragraphs.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function getEntitiesDataArray() {
  return [
    'paragraph' => [
      'en' => [
        'es_test_paragraph' => $this
          ->getCompleteParagraphInfos([
          'field_es_test_text_plain' => [
            'value' => $this->faker
              ->text(255),
            'checker_callback' => 'getValue',
          ],
          // We are testing the JSON:API field enhancer "Serialized Data" by
          // exposing this paragraph property.
          'behavior_settings' => [
            'value' => serialize(static::$behaviorSettings),
            'checker_callback' => 'getExpectedBehaviorSettingsValue',
          ],
        ]),
      ],
    ],
    'node' => [
      'en' => [
        // Paragraph reference.
        'es_test_paragraph_reference' => $this
          ->getCompleteNodeInfos([
          'field_es_test_paragraphs' => [
            'value_callback' => function () {
              return [
                [
                  'target_id' => $this
                    ->getEntityId('paragraph', 'es_test_paragraph'),
                  'target_revision_id' => $this
                    ->getEntityRevisionId('paragraph', 'es_test_paragraph'),
                ],
              ];
            },
            'checker_callback' => 'getExpectedParagraphReferenceValue',
          ],
        ]),
      ],
    ],
  ];
}