function EntityLinksTest::assertFilterProcessResult

Same name and namespace in other branches
  1. main core/modules/filter/tests/src/Kernel/EntityLinksTest.php \Drupal\Tests\filter\Kernel\EntityLinksTest::assertFilterProcessResult()

Asserts an input string + langcode yield the expected FilterProcessResult.

Parameters

string $input: The text string to be filtered.

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

\Drupal\filter\FilterProcessResult $expected_result: The expected filtered result.

4 calls to EntityLinksTest::assertFilterProcessResult()
EntityLinksTest::test in core/modules/filter/tests/src/Kernel/EntityLinksTest.php
@legacy-covers ::process
EntityLinksTest::testFileEntity in core/modules/filter/tests/src/Kernel/EntityLinksTest.php
@legacy-covers ::getUrl @legacy-covers \Drupal\file\Entity\FileLinkTarget
EntityLinksTest::testMediaEntity in core/modules/filter/tests/src/Kernel/EntityLinksTest.php
@legacy-covers ::getUrl @legacy-covers \Drupal\media\Entity\MediaLinkTarget
EntityLinksTest::testMenuLinkContentEntity in core/modules/filter/tests/src/Kernel/EntityLinksTest.php
@legacy-covers ::getUrl @legacy-covers \Drupal\menu_link_content\Entity\MenuLinkContentLinkTarget

File

core/modules/filter/tests/src/Kernel/EntityLinksTest.php, line 346

Class

EntityLinksTest
Tests the behavior of generating entity URLs when using entity links in CKEditor.

Namespace

Drupal\Tests\filter\Kernel

Code

private function assertFilterProcessResult(string $input, string $langcode, FilterProcessResult $expected_result) : void {
  $result = $this->filter
    ->process($input, $langcode);
  // No exceptions should have occurred.
  $this->assertSame([], $this->logger->records);
  // Assert both the processed text and the associated cacheability.
  $this->assertSame($expected_result->getProcessedText(), $result->getProcessedText());
  $this->assertEquals(CacheableMetadata::createFromObject($expected_result), CacheableMetadata::createFromObject($result));
}

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