function TextSummaryTest::assertTextSummary in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/text/src/Tests/TextSummaryTest.php \Drupal\text\Tests\TextSummaryTest::assertTextSummary()
Calls text_summary() and asserts that the expected teaser is returned.
3 calls to TextSummaryTest::assertTextSummary()
- TextSummaryTest::testFirstSentenceQuestion in core/
modules/ text/ src/ Tests/ TextSummaryTest.php - Tests an edge case where the first sentence is a question and subsequent sentences are not. This edge case is documented at https://www.drupal.org/node/180425.
- TextSummaryTest::testLength in core/
modules/ text/ src/ Tests/ TextSummaryTest.php - Test various summary length edge cases.
- TextSummaryTest::testLongSentence in core/
modules/ text/ src/ Tests/ TextSummaryTest.php - Test summary with long example.
File
- core/
modules/ text/ src/ Tests/ TextSummaryTest.php, line 213 - Contains \Drupal\text\Tests\TextSummaryTest.
Class
- TextSummaryTest
- Tests text_summary() with different strings and lengths.
Namespace
Drupal\text\TestsCode
function assertTextSummary($text, $expected, $format = NULL, $size = NULL) {
$summary = text_summary($text, $format, $size);
$this
->assertIdentical($summary, $expected, format_string('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', array(
'@actual' => $summary,
'@expected' => $expected,
)));
}