function MediaEmbedFilterTestBase::applyFilter

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

Applies the `@Filter=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()

6 calls to MediaEmbedFilterTestBase::applyFilter()
MediaEmbedFilterDisabledIntegrationsTest::testDisabledIntegrations in core/modules/media/tests/src/Kernel/MediaEmbedFilterDisabledIntegrationsTest.php
@covers ::renderMedia @covers ::disableContextualLinks
MediaEmbedFilterDisabledIntegrationsTest::testDisabledIntegrations in core/modules/quickedit/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

... See full list

File

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

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.