function SearchMatchTest::getText

Same name in other branches
  1. 9 core/modules/search/tests/src/Kernel/SearchMatchTest.php \Drupal\Tests\search\Kernel\SearchMatchTest::getText()
  2. 8.9.x core/modules/search/tests/src/Kernel/SearchMatchTest.php \Drupal\Tests\search\Kernel\SearchMatchTest::getText()
  3. 11.x core/modules/search/tests/src/Kernel/SearchMatchTest.php \Drupal\Tests\search\Kernel\SearchMatchTest::getText()

_test_: Helper method for generating snippets of content.

Generated items to test against: 1 ipsum 2 dolore sit 3 sit am ut 4 am ut enim am 5 ut enim am minim veniam 6 enim am minim veniam es cillum 7 am minim veniam es cillum dolore eu

1 call to SearchMatchTest::getText()
SearchMatchTest::_setup in core/modules/search/tests/src/Kernel/SearchMatchTest.php
Set up a small index of items to test against.

File

core/modules/search/tests/src/Kernel/SearchMatchTest.php, line 86

Class

SearchMatchTest
Indexes content and queries it.

Namespace

Drupal\Tests\search\Kernel

Code

public function getText($n) {
    $words = explode(' ', "Ipsum dolore sit am. Ut enim am minim veniam. Es cillum dolore eu.");
    return implode(' ', array_slice($words, $n - 1, $n));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.