function ConfigEntityImportTest::checkSinglePluginConfigSync
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::checkSinglePluginConfigSync()
- 8.9.x core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::checkSinglePluginConfigSync()
- 10 core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\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/ tests/ src/ Kernel/ Entity/ ConfigEntityImportTest.php - Tests updating an action during import.
- ConfigEntityImportTest::doBlockUpdate in core/
modules/ system/ tests/ src/ Kernel/ Entity/ ConfigEntityImportTest.php - Tests updating a block during import.
- ConfigEntityImportTest::doSearchPageUpdate in core/
modules/ system/ tests/ src/ Kernel/ Entity/ ConfigEntityImportTest.php - Tests updating a search page during import.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Entity/ ConfigEntityImportTest.php, line 229
Class
- ConfigEntityImportTest
- Tests ConfigEntity importing.
Namespace
Drupal\Tests\system\Kernel\EntityCode
protected function checkSinglePluginConfigSync(EntityWithPluginCollectionInterface $entity, $config_key, $setting_key, $expected) : void {
$plugin_collection = $entity->getPluginCollections()[$config_key];
$settings = $entity->get($config_key);
// Ensure the default config exists.
$this->assertSame($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->assertSame($settings, $entity->get($config_key));
$this->assertSame($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->assertSame($settings, $entity->get($config_key));
$this->assertSame($settings, $plugin_collection->getConfiguration());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.