function TextSummaryTest::assertTextSummary

Calls text_summary() and asserts that the expected teaser is returned.

3 calls to TextSummaryTest::assertTextSummary()
TextSummaryTest::testFirstSentenceQuestion in drupal/core/modules/text/lib/Drupal/text/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 http://drupal.org/node/180425.
TextSummaryTest::testLength in drupal/core/modules/text/lib/Drupal/text/Tests/TextSummaryTest.php
Test various summary length edge cases.
TextSummaryTest::testLongSentence in drupal/core/modules/text/lib/Drupal/text/Tests/TextSummaryTest.php
Test summary with long example.

File

drupal/core/modules/text/lib/Drupal/text/Tests/TextSummaryTest.php, line 220
Definition of Drupal\text\TextSummaryTest.

Class

TextSummaryTest
Tests the text field summary.

Namespace

Drupal\text\Tests

Code

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,
  )));
}