You are here

public function ProcessorIntegrationTest::checkEntityBundleBoostIntegration in Search API 8

Tests the UI for the "Type-specific boosting" processor.

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

File

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

Class

ProcessorIntegrationTest
Tests the admin UI for processors.

Namespace

Drupal\Tests\search_api\Functional

Code

public function checkEntityBundleBoostIntegration() {
  $configuration = [
    'boosts' => [
      'entity:node' => [
        'datasource_boost' => 3.0,
        'bundle_boosts' => [
          'article' => 5.0,
        ],
      ],
      'entity:user' => [
        'datasource_boost' => 1.0,
      ],
    ],
  ];
  $form_values = [
    'boosts' => [
      'entity:node' => [
        'datasource_boost' => Utility::formatBoostFactor(3),
        'bundle_boosts' => [
          'article' => Utility::formatBoostFactor(5),
        ],
      ],
      'entity:user' => [
        'datasource_boost' => Utility::formatBoostFactor(1),
      ],
    ],
  ];
  $form_values['boosts']['entity:node']['bundle_boosts']['page'] = '';
  $this
    ->editSettingsForm($configuration, 'type_boost', $form_values);
}