Issue #3092430 by quietone, shrutidkadam, RdeBoer, bgprior, danflanagan8: Ensure SearchPlugin has a configuration array

(cherry picked from commit 331e284ef0)
merge-requests/1590/head
Alex Pott 2021-12-27 13:57:02 +00:00
parent 2a5f29ee57
commit 62dc0bc471
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
4 changed files with 33 additions and 0 deletions

View File

@ -41,6 +41,9 @@ process:
- module
- 'constants/suffix'
path: module
configuration:
plugin: default_value
default_value: [ ]
'configuration/rankings':
plugin: search_configuration_rankings
destination:

View File

@ -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:

View File

@ -60,6 +60,20 @@ class MigrateSearchPageTest extends MigrateDrupal6TestBase {
$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']);
}
}

View File

@ -79,6 +79,19 @@ class MigrateSearchPageTest extends MigrateDrupal7TestBase {
$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);
}
/**