You are here

protected function EmbeddedEntityTest::getEmbeddedTextValue in Entity Share 8.3

Helper function to generate RTE content.

@SuppressWarnings(PHPMD.UndefinedVariable) Bug in PHPMD,

Return value

string[][] The RTE field value.

See also

https://github.com/phpmd/phpmd/issues/714

File

modules/entity_share_client/tests/src/Functional/EmbeddedEntityTest.php, line 199

Class

EmbeddedEntityTest
Functional test class for embedded entities in RTE fields.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function getEmbeddedTextValue() {
  $image_src = file_url_transform_relative(file_create_url(static::$filesData['file_image']['uri']));
  $value = <<<EOT
<p>Test image</p>

<img alt="alt" data-align="center" data-entity-type="file" data-entity-uuid="file_image" src="{<span class="php-variable">$image_src</span>}" />

<p>Test Linkit</p>

<p><a data-entity-substitution="canonical" data-entity-type="node" data-entity-uuid="es_test_embedded_linkit" href="/node/666">Test Linkit</a></p>

<p>Test Entity Embed</p>

<drupal-entity data-align="right" data-caption="test" data-embed-button="node" data-entity-embed-display="view_mode:node.teaser" data-entity-type="node" data-entity-uuid="es_test_embedded_entity_embed" data-langcode="fr"></drupal-entity>

<p>Test Media core</p>

<drupal-media data-align="center" data-entity-type="media" data-entity-uuid="es_test_document"></drupal-media>
EOT;
  return [
    [
      'value' => $value,
      'format' => 'full_html',
    ],
  ];
}