function ConfigSchemaTest::testConfigSaveWithWrappingSchema

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php \Drupal\KernelTests\Core\Config\ConfigSchemaTest::testConfigSaveWithWrappingSchema()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php \Drupal\KernelTests\Core\Config\ConfigSchemaTest::testConfigSaveWithWrappingSchema()
  3. 11.x core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php \Drupal\KernelTests\Core\Config\ConfigSchemaTest::testConfigSaveWithWrappingSchema()

Tests saving config when the type is wrapped by a dynamic type.

File

core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php, line 678

Class

ConfigSchemaTest
Tests schema for configuration objects.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testConfigSaveWithWrappingSchema() : void {
  $untyped_values = [
    'tests' => [
      [
        'wrapper_value' => 'foo',
        'plugin_id' => 'wrapper:foo',
        'internal_value' => 100,
      ],
    ],
  ];
  $typed_values = [
    'tests' => [
      [
        'plugin_id' => 'wrapper:foo',
        'internal_value' => '100',
        'wrapper_value' => 'foo',
      ],
    ],
  ];
  // Save config which has a schema that enforces types.
  \Drupal::configFactory()->getEditable('wrapping.config_schema_test.plugin_types')
    ->setData($untyped_values)
    ->save();
  $this->assertSame($typed_values, \Drupal::config('wrapping.config_schema_test.plugin_types')->get());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.