You are here

protected function SearchApiSolrTest::getLongText in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::getLongText()
  2. 8.2 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::getLongText()
  3. 4.x tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::getLongText()

Produces a string of given comprising diverse chars.

Parameters

int $length: Length of the string.

Return value

string

1 call to SearchApiSolrTest::getLongText()
SearchApiSolrTest::testSearchResultSorts in tests/src/Kernel/SearchApiSolrTest.php
Tests search result sorts.

File

tests/src/Kernel/SearchApiSolrTest.php, line 700

Class

SearchApiSolrTest
Tests index and search capabilities using the Solr search backend.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function getLongText($length) {
  $sequence = 'abcdefghijklmnopqrstuwxyz1234567890,./;\'[]\\<>?:"{}|~!@#$%^&*()_+`1234567890-=ööążźćęółńABCDEFGHIJKLMNOPQRSTUWXYZ';
  $result = '';
  $i = 0;
  $sequenceLength = strlen($sequence);
  while ($i++ != $length) {
    $result .= $sequence[$i % $sequenceLength];
  }
  return $result;
}