protected function ConfigEntityImportTest::checkSinglePluginConfigSync in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php \Drupal\system\Tests\Entity\ConfigEntityImportTest::checkSinglePluginConfigSync()
Tests that a single set of plugin config stays in sync.
Parameters
\Drupal\Core\Entity\EntityWithPluginCollectionInterface $entity: The entity.
string $config_key: Where the plugin config is stored.
string $setting_key: The setting within the plugin config to change.
mixed $expected: The expected default value of the plugin config setting.
3 calls to ConfigEntityImportTest::checkSinglePluginConfigSync()
- ConfigEntityImportTest::doActionUpdate in core/
modules/ system/ src/ Tests/ Entity/ ConfigEntityImportTest.php - Tests updating a action during import.
- ConfigEntityImportTest::doBlockUpdate in core/
modules/ system/ src/ Tests/ Entity/ ConfigEntityImportTest.php - Tests updating a block during import.
- ConfigEntityImportTest::doSearchPageUpdate in core/
modules/ system/ src/ Tests/ Entity/ ConfigEntityImportTest.php - Tests updating a search page during import.
File
- core/
modules/ system/ src/ Tests/ Entity/ ConfigEntityImportTest.php, line 188 - Contains \Drupal\system\Tests\Entity\ConfigEntityImportTest.
Class
- ConfigEntityImportTest
- Tests ConfigEntity importing.
Namespace
Drupal\system\Tests\EntityCode
protected function checkSinglePluginConfigSync(EntityWithPluginCollectionInterface $entity, $config_key, $setting_key, $expected) {
$plugin_collection = $entity
->getPluginCollections()[$config_key];
$settings = $entity
->get($config_key);
// Ensure the default config exists.
$this
->assertIdentical($expected, $settings[$setting_key]);
// Change the plugin config by setting it on the entity.
$settings[$setting_key] = $this
->randomString();
$entity
->set($config_key, $settings);
$entity
->save();
$this
->assertIdentical($settings, $entity
->get($config_key));
$this
->assertIdentical($settings, $plugin_collection
->getConfiguration());
// Change the plugin config by setting it on the plugin.
$settings[$setting_key] = $this
->randomString();
$plugin_collection
->setConfiguration($settings);
$entity
->save();
$this
->assertIdentical($settings, $entity
->get($config_key));
$this
->assertIdentical($settings, $plugin_collection
->getConfiguration());
}