function SchemaCheckTestTrait::assertConfigSchema

Same name in other branches
  1. 9 core/tests/Drupal/Tests/SchemaCheckTestTrait.php \Drupal\Tests\SchemaCheckTestTrait::assertConfigSchema()
  2. 8.9.x core/tests/Drupal/Tests/SchemaCheckTestTrait.php \Drupal\Tests\SchemaCheckTestTrait::assertConfigSchema()
  3. 11.x core/tests/Drupal/Tests/SchemaCheckTestTrait.php \Drupal\Tests\SchemaCheckTestTrait::assertConfigSchema()

Asserts the TypedConfigManager has a valid schema for the configuration.

Parameters

\Drupal\Core\Config\TypedConfigManagerInterface $typed_config: The TypedConfigManager.

string $config_name: The configuration name.

array $config_data: The configuration data.

36 calls to SchemaCheckTestTrait::assertConfigSchema()
BlockConfigSchemaTest::testBlockConfigSchema in core/modules/block/tests/src/Kernel/BlockConfigSchemaTest.php
Tests the block config schema for block plugins.
BlockConfigSchemaTest::testBlockConfigSchema in core/modules/book/tests/src/Kernel/Block/BlockConfigSchemaTest.php
Tests the block config schema for block plugins.
CKEditor5PluginManagerTest::testProvidedElements in core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php
Tests the parsing of CKEditor 5 plugin element config.
ConfigImportAllTest::testInstallUninstall in core/modules/config/tests/src/Functional/ConfigImportAllTest.php
Tests that a fixed set of modules can be installed and uninstalled.
DemoUmamiProfileTest::testConfig in core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php
Tests the profile supplied configuration is the same after installation.

... See full list

File

core/tests/Drupal/Tests/SchemaCheckTestTrait.php, line 27

Class

SchemaCheckTestTrait
Provides a class for checking configuration schema.

Namespace

Drupal\Tests

Code

public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $config_name, $config_data) {
    $check = $this->checkConfigSchema($typed_config, $config_name, $config_data);
    $message = '';
    if ($check === FALSE) {
        $message = 'Error: No schema exists.';
    }
    elseif ($check !== TRUE) {
        $this->assertIsArray($check, "The config schema check errors should be in the form of an array.");
        $message = "Errors:\n";
        foreach ($check as $key => $error) {
            $message .= "Schema key {$key} failed with: {$error}\n";
        }
    }
    $this->assertTrue($check, "There should be no errors in configuration '{$config_name}'. {$message}");
}

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