You are here

function ConfigSchemaTest::testSchemaFallback in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/src/Tests/ConfigSchemaTest.php \Drupal\config\Tests\ConfigSchemaTest::testSchemaFallback()

Tests fallback to a greedy wildcard.

File

core/modules/config/src/Tests/ConfigSchemaTest.php, line 395
Contains \Drupal\config\Tests\ConfigSchemaTest.

Class

ConfigSchemaTest
Tests schema for configuration objects.

Namespace

Drupal\config\Tests

Code

function testSchemaFallback() {
  $definition = \Drupal::service('config.typed')
    ->getDefinition('config_schema_test.wildcard_fallback.something');

  // This should be the schema of config_schema_test.wildcard_fallback.*.
  $expected = array();
  $expected['label'] = 'Schema wildcard fallback test';
  $expected['class'] = '\\Drupal\\Core\\Config\\Schema\\Mapping';
  $expected['definition_class'] = '\\Drupal\\Core\\TypedData\\MapDataDefinition';
  $expected['mapping']['langcode']['type'] = 'string';
  $expected['mapping']['langcode']['label'] = 'Language code';
  $expected['mapping']['testid']['type'] = 'string';
  $expected['mapping']['testid']['label'] = 'ID';
  $expected['mapping']['testdescription']['type'] = 'text';
  $expected['mapping']['testdescription']['label'] = 'Description';
  $expected['type'] = 'config_schema_test.wildcard_fallback.*';
  $this
    ->assertEqual($definition, $expected, 'Retrieved the right metadata for config_schema_test.wildcard_fallback.something');
  $definition2 = \Drupal::service('config.typed')
    ->getDefinition('config_schema_test.wildcard_fallback.something.something');

  // This should be the schema of config_schema_test.wildcard_fallback.* as

  //well.
  $this
    ->assertIdentical($definition, $definition2);
}