function MediaEmbedFilterTestBase::applyFilter

Same name in other branches
  1. 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTestBase::applyFilter()
  2. 8.9.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTestBase::applyFilter()
  3. 10 core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTestBase::applyFilter()

Applies the `media_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\media\Kernel\MediaEmbedFilterTestBase::createEmbedCode()

\Drupal\KernelTests\AssertContentTrait::setRawContent()

5 calls to MediaEmbedFilterTestBase::applyFilter()
MediaEmbedFilterDisabledIntegrationsTest::testDisabledIntegrations in core/modules/media/tests/src/Kernel/MediaEmbedFilterDisabledIntegrationsTest.php
@covers ::renderMedia @covers ::disableContextualLinks
MediaEmbedFilterTest::testAccessUnpublished in core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php
Tests that entity access is respected by embedding an unpublished entity.
MediaEmbedFilterTest::testBasics in core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php
Ensures media entities are rendered correctly.
MediaEmbedFilterTest::testOverridesAltAndTitle in core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php
@covers ::applyPerEmbedMediaOverrides @dataProvider providerOverridesAltAndTitle
MediaEmbedFilterTest::testRecursionProtection in core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php
Tests recursive rendering protection.

File

core/modules/media/tests/src/Kernel/MediaEmbedFilterTestBase.php, line 181

Class

MediaEmbedFilterTestBase
Base class for Media Embed filter tests.

Namespace

Drupal\Tests\media\Kernel

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.