You are here

protected function EntityEmbedFilterTestBase::applyFilter in Entity Embed 8

Applies the `@Filter=entity_embed` filter to text, pipes to raw content.

Parameters

string $text: The text string to be filtered.

string $langcode: The language code of the text to be filtered.

Return value

\Drupal\filter\FilterProcessResult The filtered text, wrapped in a FilterProcessResult object, and possibly with associated assets, cacheability metadata and placeholders.

See also

\Drupal\Tests\entity_embed\Kernel\EntityEmbedFilterTestBase::createEmbedCode()

\Drupal\KernelTests\AssertContentTrait::setRawContent()

11 calls to EntityEmbedFilterTestBase::applyFilter()
EntityEmbedFilterDisabledIntegrationsTest::testDisabledIntegrations in tests/src/Kernel/EntityEmbedFilterDisabledIntegrationsTest.php
@covers \Drupal\entity_embed\Plugin\entity_embed\EntityEmbedDisplay\EntityReferenceFieldFormatter::disableContextualLinks @covers \Drupal\entity_embed\Plugin\entity_embed\EntityEmbedDisplay\EntityReferenceFieldFormatter::disableQuickEdit @dataProvider…
EntityEmbedFilterLegacyTest::testEntityEmbedDisplayDefaultBackwardsCompatibility in tests/src/Kernel/EntityEmbedFilterLegacyTest.php
Tests BC for `data-entity-embed-display="default"`.
EntityEmbedFilterLegacyTest::testEntityEmbedSettingsBackwardsCompatibility in tests/src/Kernel/EntityEmbedFilterLegacyTest.php
Tests BC for `data-entity-embed-display-settings`'s predecessor.
EntityEmbedFilterLegacyTest::testEntityIdBackwardsCompatibility in tests/src/Kernel/EntityEmbedFilterLegacyTest.php
Tests BC for `data-entity-uuid`'s predecessor, `data-entity-id`.
EntityEmbedFilterLegacyTest::testEntityIdIgnoredIfEntityUuidPresent in tests/src/Kernel/EntityEmbedFilterLegacyTest.php
Verifies `data-entity-id` is ignored when `data-entity-uuid` is present.

... See full list

File

tests/src/Kernel/EntityEmbedFilterTestBase.php, line 124

Class

EntityEmbedFilterTestBase
Base class for Entity Embed filter tests.

Namespace

Drupal\Tests\entity_embed\Kernel

Code

protected function applyFilter($text, $langcode = 'en') {
  $this
    ->assertStringContainsString('<drupal-entity', $text);
  $this
    ->assertStringContainsString('This placeholder should not be rendered.', $text);
  $filter_result = $this
    ->processText($text, $langcode);
  $output = $filter_result
    ->getProcessedText();
  $this
    ->assertStringNotContainsString('<drupal-entity', $output);
  $this
    ->assertStringNotContainsString('This placeholder should not be rendered.', $output);
  $this
    ->setRawContent($output);
  return $filter_result;
}