You are here

protected function TestPluginTrait::checkError in Search API 8

Throws an exception if set in the Drupal state for the given method.

Parameters

string $method: The method on this object from which this method was called.

Throws

\Drupal\search_api\SearchApiException Thrown if state "search_api_test.TYPE.exception.$method" is TRUE.

1 call to TestPluginTrait::checkError()
TestBackend::checkError in tests/search_api_test/src/Plugin/search_api/backend/TestBackend.php

File

tests/search_api_test/src/TestPluginTrait.php, line 28

Class

TestPluginTrait
Provides common functionality for test plugins.

Namespace

Drupal\search_api_test

Code

protected function checkError($method) {
  $type = $this
    ->getPluginType();
  $state = \Drupal::state();
  if ($state
    ->get("search_api_test.{$type}.exception.{$method}")) {
    throw new SearchApiException($method);
  }
}