You are here

public function ConfigSchemaTest::testColonsInSchemaTypeDetermination in Drupal 8

Same name and namespace in other branches
  1. 9 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 523

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
    ->assertEqual($definition['type'], 'test.plugin_types.boolean');
  $definition = $tests[1]
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEqual($definition['type'], 'test.plugin_types.boolean:*');
  $definition = $tests[2]
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEqual($definition['type'], 'test.plugin_types.*');
  $definition = $tests[3]
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEqual($definition['type'], 'test.plugin_types.*');
  $tests = \Drupal::service('config.typed')
    ->get('config_schema_test.plugin_types')
    ->get('test_with_parents')
    ->getElements();
  $definition = $tests[0]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEqual($definition['type'], 'test_with_parents.plugin_types.boolean');
  $definition = $tests[1]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEqual($definition['type'], 'test_with_parents.plugin_types.boolean:*');
  $definition = $tests[2]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEqual($definition['type'], 'test_with_parents.plugin_types.*');
  $definition = $tests[3]
    ->get('settings')
    ->getDataDefinition()
    ->toArray();
  $this
    ->assertEqual($definition['type'], 'test_with_parents.plugin_types.*');
}