You are here

public function FieldsProcessorPluginBaseTest::testTestField in Search API 8

Tests whether selecting fields works correctly.

File

tests/src/Unit/Processor/FieldsProcessorPluginBaseTest.php, line 174

Class

FieldsProcessorPluginBaseTest
Tests the base class for fields-based processors.

Namespace

Drupal\Tests\search_api\Unit\Processor

Code

public function testTestField() {

  // testType() shouldn't have any effect anymore when fields are configured.
  $override = function () {
    return FALSE;
  };
  $this->processor
    ->setMethodOverride('testType', $override);
  $configuration['fields'] = [
    'text_field',
    'float_field',
  ];
  $this->processor
    ->setConfiguration($configuration);
  $items = $this
    ->getTestItem();
  $this->processor
    ->preprocessIndexItems($items);
  $this
    ->assertFieldsProcessed($items, [
    'text_field',
    'float_field',
  ]);
}