public function TextSummaryTest::assertTextSummary in Drupal 10
Same name and namespace in other branches
- 8 core/modules/text/tests/src/Kernel/TextSummaryTest.php \Drupal\Tests\text\Kernel\TextSummaryTest::assertTextSummary()
- 9 core/modules/text/tests/src/Kernel/TextSummaryTest.php \Drupal\Tests\text\Kernel\TextSummaryTest::assertTextSummary()
Calls text_summary() and asserts that the expected teaser is returned.
@internal
File
- core/
modules/ text/ tests/ src/ Kernel/ TextSummaryTest.php, line 244
Class
- TextSummaryTest
- Tests text_summary() with different strings and lengths.
Namespace
Drupal\Tests\text\KernelCode
public function assertTextSummary(string $text, string $expected, ?string $format = NULL, int $size = NULL) : void {
$summary = text_summary($text, $format, $size);
$this
->assertSame($expected, $summary, new FormattableMarkup('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', [
'@actual' => $summary,
'@expected' => $expected,
]));
}