function TextSummaryTest::assertTextSummary
Same name in other branches
- 9 core/modules/text/tests/src/Kernel/TextSummaryTest.php \Drupal\Tests\text\Kernel\TextSummaryTest::assertTextSummary()
- 8.9.x core/modules/text/tests/src/Kernel/TextSummaryTest.php \Drupal\Tests\text\Kernel\TextSummaryTest::assertTextSummary()
- 11.x 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
4 calls to TextSummaryTest::assertTextSummary()
- TextSummaryTest::testFirstSentenceQuestion in core/
modules/ text/ tests/ src/ Kernel/ TextSummaryTest.php - Tests text summaries for a question followed by a sentence.
- TextSummaryTest::testInvalidFilterFormat in core/
modules/ text/ tests/ src/ Kernel/ TextSummaryTest.php - Tests text summaries with an invalid filter format.
- TextSummaryTest::testLength in core/
modules/ text/ tests/ src/ Kernel/ TextSummaryTest.php - Tests various summary length edge cases.
- TextSummaryTest::testLongSentence in core/
modules/ text/ tests/ src/ Kernel/ TextSummaryTest.php - Tests summary with long example.
File
-
core/
modules/ text/ tests/ src/ Kernel/ TextSummaryTest.php, line 250
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, '<pre style="white-space: pre-wrap">' . $summary . '</pre> is identical to <pre style="white-space: pre-wrap">' . $expected . '</pre>');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.