You are here

protected function PluginTestTrait::setError in Search API 8

Sets an exception to be thrown on calls to the given method.

Parameters

string $plugin_type: The "short" plugin type.

string $method: The method on the plugin object which should throw an exception.

bool $error: (optional) If TRUE, further calls to the method will throw exceptions, otherwise they won't.

7 calls to PluginTestTrait::setError()
IntegrationTest::checkIndexing in tests/src/Functional/IntegrationTest.php
Tests whether indexing via the UI works correctly.
ServerTaskTest::testAddIndex in tests/src/Kernel/Server/ServerTaskTest.php
Tests task system integration for the server's addIndex() method.
ServerTaskTest::testAutomaticTaskRemoval in tests/src/Kernel/Server/ServerTaskTest.php
Tests the correct automatic removal of tasks upon certain operations.
ServerTaskTest::testDeleteAllIndexItems in tests/src/Kernel/Server/ServerTaskTest.php
Tests task system integration for the deleteAllIndexItems() method.
ServerTaskTest::testDeleteItems in tests/src/Kernel/Server/ServerTaskTest.php
Tests task system integration for the server's deleteItems() method.

... See full list

File

tests/search_api_test/src/PluginTestTrait.php, line 23

Class

PluginTestTrait
Provides functionality for tests that deal with test plugins.

Namespace

Drupal\search_api_test

Code

protected function setError($plugin_type, $method, $error = TRUE) {
  $key = "search_api_test.{$plugin_type}.exception.{$method}";
  \Drupal::state()
    ->set($key, $error);
}