function ConfigSchemaTest::testLangcodeRequiredIfTranslatableValuesConstraintError

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

File

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

Class

ConfigSchemaTest
Tests schema for configuration objects.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testLangcodeRequiredIfTranslatableValuesConstraintError() : void {
    $config = \Drupal::configFactory()->getEditable('config_test.foo');
    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('The LangcodeRequiredIfTranslatableValues constraint is applied to \'config_test.foo::broken_langcode_required\'. This constraint can only operate on the root object being validated.');
    $config->set('broken_langcode_required.foo', 'bar')
        ->save();
}

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