You are here

public function EntityEmbedFilterLegacyTest::testEntityIdIgnoredIfEntityUuidPresent in Entity Embed 8

Verifies `data-entity-id` is ignored when `data-entity-uuid` is present.

File

tests/src/Kernel/EntityEmbedFilterLegacyTest.php, line 45

Class

EntityEmbedFilterLegacyTest
@coversDefaultClass \Drupal\entity_embed\Plugin\Filter\EntityEmbedFilter @group entity_embed @group legacy

Namespace

Drupal\Tests\entity_embed\Kernel

Code

public function testEntityIdIgnoredIfEntityUuidPresent() {
  $nonsensical_id = $this
    ->randomMachineName();
  $content = $this
    ->createEmbedCode([
    'data-entity-type' => 'node',
    'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
    'data-entity-id' => $nonsensical_id,
    'data-view-mode' => 'teaser',
  ]);
  $this
    ->applyFilter($content);
  $this
    ->assertHasAttributes($this
    ->cssSelect('div.embedded-entity')[0], [
    'data-entity-type' => 'node',
    'data-entity-id' => $nonsensical_id,
    'data-view-mode' => 'teaser',
    'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
    'data-langcode' => 'en',
    'data-entity-embed-display' => 'entity_reference:entity_reference_entity_view',
    'data-entity-embed-display-settings' => 'teaser',
  ]);
}