public function EntityEmbedFilterTest::providerTestBasics in Entity Embed 8
Data provider for testBasics().
File
- tests/
src/ Kernel/ EntityEmbedFilterTest.php, line 61
Class
- EntityEmbedFilterTest
- @coversDefaultClass \Drupal\entity_embed\Plugin\Filter\EntityEmbedFilter @group entity_embed
Namespace
Drupal\Tests\entity_embed\KernelCode
public function providerTestBasics() {
return [
'data-entity-uuid + data-view-mode=teaser' => [
[
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-view-mode' => 'teaser',
],
'teaser',
[
'data-entity-type' => 'node',
'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',
],
],
'data-entity-uuid + data-view-mode=full' => [
[
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-view-mode' => 'full',
],
'default',
[
'data-entity-type' => 'node',
'data-view-mode' => 'full',
'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' => 'full',
],
],
'data-entity-uuid + data-view-mode=default' => [
[
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-view-mode' => 'default',
],
'default',
[
'data-entity-type' => 'node',
'data-view-mode' => 'default',
'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' => 'default',
],
],
'data-entity-uuid + data-entity-embed-display' => [
[
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-entity-embed-display' => 'entity_reference:entity_reference_entity_view',
'data-entity-embed-display-settings' => '{"view_mode":"full"}',
],
'default',
[
'data-entity-embed-display' => 'entity_reference:entity_reference_entity_view',
'data-entity-embed-display-settings' => 'full',
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-langcode' => 'en',
],
],
'data-entity-uuid + data-entity-embed-display + data-view-mode ⇒ data-entity-embed-display wins' => [
[
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-entity-embed-display' => 'default',
'data-entity-embed-display-settings' => '{"view_mode":"full"}',
'data-view-mode' => 'some-invalid-view-mode',
],
'default',
[
'data-entity-embed-display' => 'entity_reference:entity_reference_entity_view',
'data-entity-embed-display-settings' => 'full',
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-view-mode' => 'some-invalid-view-mode',
'data-langcode' => 'en',
],
],
'custom attributes are retained' => [
[
'data-foo' => 'bar',
'foo' => 'bar',
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-view-mode' => 'teaser',
],
'teaser',
[
'data-foo' => 'bar',
'foo' => 'bar',
'data-entity-type' => 'node',
'data-entity-uuid' => static::EMBEDDED_ENTITY_UUID,
'data-view-mode' => 'teaser',
'data-langcode' => 'en',
'data-entity-embed-display' => 'entity_reference:entity_reference_entity_view',
'data-entity-embed-display-settings' => 'teaser',
],
],
];
}