function ConfigSchemaTest::testLangcodeRequiredIfTranslatableValuesConstraintError

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

@group legacy

File

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

Class

ConfigSchemaTest
Tests schema for configuration objects.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testLangcodeRequiredIfTranslatableValuesConstraintError() : void {
    $config = \Drupal::configFactory()->getEditable('config_test.foo');
    $config->set('broken_langcode_required.foo', 'bar')
        ->save();
    $this->expectDeprecation('The LangcodeRequiredIfTranslatableValues constraint can only be applied to the root object being validated, using the \'config_object\' schema type on \'config_test.foo::broken_langcode_required\' is deprecated in drupal:10.3.0 and will trigger a \\LogicException in drupal:11.0.0. See https://www.drupal.org/node/3459863');
    $violations = \Drupal::service('config.typed')->createFromNameAndData($config->getName(), $config->get())
        ->validate();
    $this->assertCount(0, $violations);
}

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