You are here

protected function BackendTest::checkSecondServer in Search API 8

Tests that a second server doesn't interfere with the first.

Overrides BackendTestBase::checkSecondServer

File

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

Class

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

Namespace

Drupal\Tests\search_api_db\Kernel

Code

protected function checkSecondServer() {

  /** @var \Drupal\search_api\ServerInterface $second_server */
  $second_server = Server::create([
    'id' => 'test2',
    'backend' => 'search_api_db',
    'backend_config' => [
      'database' => 'default:default',
    ],
  ]);
  $second_server
    ->save();
  $query = $this
    ->buildSearch();
  try {
    $second_server
      ->search($query);
    $this
      ->fail('Could execute a query for an index on a different server.');
  } catch (SearchApiException $e) {
    $this
      ->assertTrue(TRUE, 'Executing a query for an index on a different server throws an exception.');
  }
  $second_server
    ->delete();
}