function ConfigEntityValidationTestBase::isFullyValidatable

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php \Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase::isFullyValidatable()

Whether the tested config entity type is fully validatable.

Return value

bool Whether the tested config entity type is fully validatable.

4 calls to ConfigEntityValidationTestBase::isFullyValidatable()
ConfigEntityValidationTestBase::getPropertiesWithOptionalValues in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php
Determines the config entity properties with optional values.
ConfigEntityValidationTestBase::getRequiredPropertyKeys in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php
Determines the config entity mapping properties with required keys.
ConfigEntityValidationTestBase::testRequiredPropertyKeysMissing in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php
A property that is required must have a value (i.e. not NULL).
ConfigEntityValidationTestBase::testRequiredPropertyValuesMissing in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php
A property that is required must have a value (i.e. not NULL).

File

core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php, line 613

Class

ConfigEntityValidationTestBase
Base class for testing validation of config entities.

Namespace

Drupal\KernelTests\Core\Config

Code

protected function isFullyValidatable() : bool {
    $typed_config = $this->container
        ->get('config.typed');
    assert($typed_config instanceof TypedConfigManagerInterface);
    // @see \Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter::getConfigTypedData()
    $config_entity_type_schema_constraints = $typed_config->createFromNameAndData($this->entity
        ->getConfigDependencyName(), $this->entity
        ->toArray())
        ->getConstraints();
    foreach ($config_entity_type_schema_constraints as $constraint) {
        if ($constraint instanceof FullyValidatableConstraint) {
            return TRUE;
        }
    }
    return FALSE;
}

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