function ConfigEntityNormalizeTest::testNormalize
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php \Drupal\KernelTests\Core\Config\ConfigEntityNormalizeTest::testNormalize()
- 8.9.x core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php \Drupal\KernelTests\Core\Config\ConfigEntityNormalizeTest::testNormalize()
- 10 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php \Drupal\KernelTests\Core\Config\ConfigEntityNormalizeTest::testNormalize()
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigEntityNormalizeTest.php, line 29
Class
- ConfigEntityNormalizeTest
- Tests the listing of configuration entities.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testNormalize() : void {
$config_entity = \Drupal::entityTypeManager()->getStorage('config_test')
->create([
'id' => 'system',
'label' => 'foobar',
'weight' => 1,
]);
$config_entity->save();
// Modify stored config entity, this is comparable with a schema change.
$config = $this->config('config_test.dynamic.system');
$data = [
'label' => 'foobar',
'additional_key' => TRUE,
] + $config->getRawData();
$config->setData($data)
->save();
$this->assertNotSame($config_entity->toArray(), $config->getRawData(), 'Stored config entity is not is equivalent to config schema.');
$config_entity = \Drupal::entityTypeManager()->getStorage('config_test')
->load('system');
$config_entity->save();
$config = $this->config('config_test.dynamic.system');
$this->assertSame($config_entity->toArray(), $config->getRawData(), 'Stored config entity is equivalent to config schema.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.