You are here

protected function ProcessorIntegrationTest::checkValidationError in Search API 8

Makes sure that the given form values will fail when submitted.

Parameters

array $form_values: The form values, relative to the processor form.

string $processor_id: The processor's ID.

string[]|string $messages: Either the expected error message or an array of expected error messages.

3 calls to ProcessorIntegrationTest::checkValidationError()
ProcessorIntegrationTest::checkHtmlFilterIntegration in tests/src/Functional/ProcessorIntegrationTest.php
Tests the UI for the "HTML filter" processor.
ProcessorIntegrationTest::checkIgnoreCharactersIntegration in tests/src/Functional/ProcessorIntegrationTest.php
Tests the UI for the "Ignore characters" processor.
ProcessorIntegrationTest::checkTokenizerIntegration in tests/src/Functional/ProcessorIntegrationTest.php
Tests the UI for the "Tokenizer" processor.

File

tests/src/Functional/ProcessorIntegrationTest.php, line 813

Class

ProcessorIntegrationTest
Tests the admin UI for processors.

Namespace

Drupal\Tests\search_api\Functional

Code

protected function checkValidationError(array $form_values, $processor_id, $messages) {
  $this
    ->loadProcessorsTab();
  $edit = $this
    ->getFormValues($form_values, "processors[{$processor_id}][settings]");
  $edit["status[{$processor_id}]"] = 1;
  $this
    ->submitForm($edit, 'Save');
  if (!is_array($messages)) {
    $messages = [
      $messages,
    ];
  }
  foreach ($messages as $message) {
    $this
      ->assertSession()
      ->responseContains($message);
  }
  $this
    ->assertSession()
    ->pageTextNotContains('The indexing workflow was successfully edited.');
  $this
    ->assertSession()
    ->pageTextNotContains('No values were changed.');
  $this
    ->loadProcessorsTab(TRUE);
}