Same filename and directory in other branches
- 10 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php
- 9 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php
Namespace
Drupal\KernelTests\Core\Config
File
core/tests/Drupal/KernelTests/Core/Config/ConfigEntityNormalizeTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Config;
use Drupal\KernelTests\KernelTestBase;
class ConfigEntityNormalizeTest extends KernelTestBase {
public static $modules = [
'config_test',
];
protected function setUp() {
parent::setUp();
$this
->installConfig(static::$modules);
}
public function testNormalize() {
$config_entity = \Drupal::entityTypeManager()
->getStorage('config_test')
->create([
'id' => 'system',
'label' => 'foobar',
'weight' => 1,
]);
$config_entity
->save();
$config = $this
->config('config_test.dynamic.system');
$data = [
'label' => 'foobar',
'additional_key' => TRUE,
] + $config
->getRawData();
$config
->setData($data)
->save();
$this
->assertNotIdentical($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
->assertIdentical($config_entity
->toArray(), $config
->getRawData(), 'Stored config entity is equivalent to config schema.');
}
}
Classes