diff --git a/core/modules/search/migrations/d7_search_page.yml b/core/modules/search/migrations/d7_search_page.yml index 033bd409d62b9b0c4327d6829928971397099e20..cb30ed1347048fdf67f5ef912809afb6fd6bc9e9 100644 --- a/core/modules/search/migrations/d7_search_page.yml +++ b/core/modules/search/migrations/d7_search_page.yml @@ -41,6 +41,9 @@ process: - module - 'constants/suffix' path: module + configuration: + plugin: default_value + default_value: [ ] 'configuration/rankings': plugin: search_configuration_rankings destination: diff --git a/core/modules/search/migrations/search_page.yml b/core/modules/search/migrations/search_page.yml index 2847a191ff4a0a0e714948a157da6911113f1e26..9ab1858c40a6ce04085a74f8721d0432bfce2cc6 100644 --- a/core/modules/search/migrations/search_page.yml +++ b/core/modules/search/migrations/search_page.yml @@ -21,6 +21,9 @@ process: id: 'constants/id' path: 'constants/path' plugin: 'constants/plugin' + configuration: + plugin: default_value + default_value: [ ] 'configuration/rankings': plugin: search_configuration_rankings destination: diff --git a/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php b/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php index 1321943b5e18aca3b24e4efe8e946bcaafe32017..e98da3bac609ce1536cab9055bffdc29c9e7f3ab 100644 --- a/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php +++ b/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php @@ -60,6 +60,20 @@ public function testSearchPage() { $configuration = SearchPage::load($id)->getPlugin()->getConfiguration(); $this->assertSame(4, $configuration['rankings']['comments']); + + // Test that a configurable search without a configuration imports. Do this + // by removing the node rankings from the source database. + Database::getConnection('default', 'migrate') + ->delete('variable') + ->condition('name', 'node_rank_%', 'LIKE') + ->execute(); + + $migration = $this->getMigration('search_page'); + $migration->getIdMap()->prepareUpdate(); + $this->executeMigration($migration); + + $configuration = SearchPage::load($id)->getPlugin()->getConfiguration(); + $this->assertSame([], $configuration['rankings']); } } diff --git a/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php b/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php index d3e8ee38ea987cb5107807bc934b5c8cc61a3feb..8d353e0a76eb2cc729a81a6141e44a93884864db 100644 --- a/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php +++ b/core/modules/search/tests/src/Kernel/Migrate/d7/MigrateSearchPageTest.php @@ -79,6 +79,19 @@ public function testSearchPage() { $this->executeMigration($migration); $configuration['rankings']['comments'] = 4; $this->assertEntity('node_search', 'node', TRUE, $configuration); + + // Test that a configurable search without a configuration imports. Do this + // by removing the node rankings from the source database. + Database::getConnection('default', 'migrate') + ->delete('variable') + ->condition('name', 'node_rank_%', 'LIKE') + ->execute(); + + $migration = $this->getMigration('d7_search_page'); + $migration->getIdMap()->prepareUpdate(); + $this->executeMigration($migration); + $configuration = ['rankings' => []]; + $this->assertEntity('node_search', 'node', TRUE, $configuration); } /**