You are here

protected function ProcessorIntegrationTest::checkLanguageWithFallbackIntegration in Search API 8

Tests the integration of the "Language (with fallback)" processor.

1 call to ProcessorIntegrationTest::checkLanguageWithFallbackIntegration()
ProcessorIntegrationTest::testProcessorIntegration in tests/src/Functional/ProcessorIntegrationTest.php
Tests the admin UI for processors.

File

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

Class

ProcessorIntegrationTest
Tests the admin UI for processors.

Namespace

Drupal\Tests\search_api\Functional

Code

protected function checkLanguageWithFallbackIntegration() {

  // Test that the processor is locked.
  $index = $this
    ->loadIndex();
  $index
    ->removeProcessor('language_with_fallback');
  $index
    ->save();
  $this
    ->assertTrue($this
    ->loadIndex()
    ->isValidProcessor('language_with_fallback'), 'The "Language (with fallback)" processor cannot be disabled.');

  // Add a language_with_fallback field.
  $options['query']['datasource'] = '';
  $this
    ->drupalGet($this
    ->getIndexPath('fields/add/nojs'), $options);

  // See \Drupal\search_api\Tests\IntegrationTest::addField().
  $this
    ->assertSession()
    ->responseContains('name="language_with_fallback"');
  $this
    ->submitForm([], 'language_with_fallback');
  $args['%label'] = 'Language (with fallback)';
  $this
    ->assertSession()
    ->responseContains(new FormattableMarkup('Field %label was added to the index.', $args));
}