You are here

public function ConfigSchemaTest::testColonsInSchemaTypeDetermination in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php \Drupal\KernelTests\Core\Config\ConfigSchemaTest::testColonsInSchemaTypeDetermination()

Tests use of colons in schema type determination.

See also

\Drupal\Core\Config\TypedConfigManager::getFallbackName()

File

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

Class

ConfigSchemaTest
Tests schema for configuration objects.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testColonsInSchemaTypeDetermination() {
  $tests = \Drupal::service('config.typed')
    ->get('config_schema_test.plugin_types')
    ->get('tests')
    ->getElements();
  $definition = $tests[0]
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test.plugin_types.boolean', $definition['type']);
  $definition = $tests[1]
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test.plugin_types.boolean:*', $definition['type']);
  $definition = $tests[2]
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test.plugin_types.*', $definition['type']);
  $definition = $tests[3]
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test.plugin_types.*', $definition['type']);
  $tests = \Drupal::service('config.typed')
    ->get('config_schema_test.plugin_types')
    ->get('test_with_parents')
    ->getElements();
  $definition = $tests[0]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test_with_parents.plugin_types.boolean', $definition['type']);
  $definition = $tests[1]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test_with_parents.plugin_types.boolean:*', $definition['type']);
  $definition = $tests[2]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test_with_parents.plugin_types.*', $definition['type']);
  $definition = $tests[3]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEquals('test_with_parents.plugin_types.*', $definition['type']);
}