You are here

protected function BackendTest::regressionTest2557291 in Search API 8

Tests the case-sensitivity of fulltext searches.

See also

https://www.drupal.org/node/2557291

1 call to BackendTest::regressionTest2557291()
BackendTest::backendSpecificRegressionTests in modules/search_api_db/tests/src/Kernel/BackendTest.php
Runs backend specific regression tests.

File

modules/search_api_db/tests/src/Kernel/BackendTest.php, line 574

Class

BackendTest
Tests index and search capabilities using the Database search backend.

Namespace

Drupal\Tests\search_api_db\Kernel

Code

protected function regressionTest2557291() {
  $results = $this
    ->buildSearch('case')
    ->execute();
  $this
    ->assertResults([
    1,
  ], $results, 'Search for lowercase "case"');
  $results = $this
    ->buildSearch('Case')
    ->execute();
  $this
    ->assertResults([
    1,
    3,
  ], $results, 'Search for capitalized "Case"');
  $results = $this
    ->buildSearch('CASE')
    ->execute();
  $this
    ->assertResults([], $results, 'Search for non-existent uppercase version of "CASE"');
  $results = $this
    ->buildSearch('föö')
    ->execute();
  $this
    ->assertResults([
    1,
  ], $results, 'Search for keywords with umlauts');
  $results = $this
    ->buildSearch('smile' . json_decode('"\\u1F601"'))
    ->execute();
  $this
    ->assertResults([
    1,
  ], $results, 'Search for keywords with umlauts');
  $results = $this
    ->buildSearch()
    ->addCondition('keywords', 'grape', '<>')
    ->execute();
  $this
    ->assertResults([
    1,
    3,
  ], $results, 'Negated filter on multi-valued field');
}