You are here

function TextSummaryTest::testFirstSentenceQuestion in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/text/src/Tests/TextSummaryTest.php \Drupal\text\Tests\TextSummaryTest::testFirstSentenceQuestion()

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.

File

core/modules/text/src/Tests/TextSummaryTest.php, line 33
Contains \Drupal\text\Tests\TextSummaryTest.

Class

TextSummaryTest
Tests text_summary() with different strings and lengths.

Namespace

Drupal\text\Tests

Code

function testFirstSentenceQuestion() {
  $text = 'A question? A sentence. Another sentence.';
  $expected = 'A question? A sentence.';
  $this
    ->assertTextSummary($text, $expected, NULL, 30);
}