function StringEqualsConcatenatedValuesConstraintValidatorTest::testValueTypes
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Validation/StringEqualsConcatenatedValuesConstraintValidatorTest.php \Drupal\KernelTests\Core\Validation\StringEqualsConcatenatedValuesConstraintValidatorTest::testValueTypes()
Tests concatenation of basic schema value types.
Attributes
#[DataProvider('valueTypesProvider')]
See also
\Drupal\Core\Validation\Plugin\Validation\Constraint\StringEqualsConcatenatedValuesConstraint
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Validation/ StringEqualsConcatenatedValuesConstraintValidatorTest.php, line 99
Class
- StringEqualsConcatenatedValuesConstraintValidatorTest
- Tests the StringEqualsConcatenatedValues validator.
Namespace
Drupal\KernelTests\Core\ValidationCode
public function testValueTypes($first_value, $second_value, $result, $invalid_result) : void {
$editable_config = \Drupal::configFactory()->getEditable('config_test.validation');
$editable_config->set('string_concat_value_1', $first_value);
$editable_config->set('string_concat_value_2', $second_value);
$editable_config->set('string_concat_values', $result);
$editable_config->save();
$this->expectExceptionMessage("Schema errors for config_test.validation with the following errors: 0 [string_concat_values] Expected '{$result}', not '{$invalid_result}'. Format: '<%parent.string_concat_value_1>.<%parent.string_concat_value_2>'");
$editable_config->set('string_concat_values', $invalid_result);
$editable_config->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.