You are here

protected function BackendTest::regressionTest2916534 in Search API 8

Tests edge cases for partial matching.

See also

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

1 call to BackendTest::regressionTest2916534()
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 763

Class

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

Namespace

Drupal\Tests\search_api_db\Kernel

Code

protected function regressionTest2916534() {
  $old = $this
    ->getServer()
    ->getBackendConfig()['matching'];
  $this
    ->setServerMatchMode();
  $entity_id = count($this->entities) + 1;
  $entity = $this
    ->addTestEntity($entity_id, [
    'name' => 'foo foobar foobar',
    'type' => 'article',
  ]);
  $this
    ->indexItems($this->indexId);
  $results = $this
    ->buildSearch('foo', [], [
    'name',
  ])
    ->execute();
  $this
    ->assertResults([
    1,
    2,
    4,
    $entity_id,
  ], $results, 'Partial search for »foo«');
  $entity
    ->delete();
  $this
    ->setServerMatchMode($old);
}