function SearchPageImportTest::testSearchPageImport

Same name and namespace in other branches
  1. 11.x core/modules/search/tests/src/Kernel/SearchPageImportTest.php \Drupal\Tests\search\Kernel\SearchPageImportTest::testSearchPageImport()

Tests updating a search page during import.

File

core/modules/search/tests/src/Kernel/SearchPageImportTest.php, line 33

Class

SearchPageImportTest
Tests search page import.

Namespace

Drupal\Tests\search\Kernel

Code

public function testSearchPageImport() : void {
  $this->installConfig([
    'system',
  ]);
  $config_storage = $this->container
    ->get('config.storage');
  // Ensure the 'system.site' config.
  $config_storage->write('system.site', [
    'uuid' => (new Php())->generate(),
  ]);
  $this->copyConfig($config_storage, $this->container
    ->get('config.storage.sync'));
  // Create a test search page with a known label.
  $name = 'search.page.apple';
  $entity = SearchPage::create([
    'id' => 'apple',
    'label' => 'Apple search',
    'path' => 'apple',
    'plugin' => 'search_extra_type_search',
  ]);
  $entity->save();
  $this->checkSinglePluginConfigSync($entity, 'configuration', 'boost', 'bi');
  // Read the existing data, and prepare an altered version in sync.
  $custom_data = $original_data = $this->container
    ->get('config.storage')
    ->read($name);
  $custom_data['configuration']['boost'] = 'asdf';
  $this->assertConfigUpdateImport($name, $original_data, $custom_data);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.