public function ConfigTest::validateNameProvider in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::validateNameProvider()
Provides data to test name validation.
See also
\Drupal\Tests\Core\Config\ConfigTest::testValidateNameException()
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ ConfigTest.php, line 436
Class
- ConfigTest
- Tests the Config.
Namespace
Drupal\Tests\Core\ConfigCode
public function validateNameProvider() {
$return = [
// Name missing namespace (dot).
[
'MissingNamespace',
'Missing namespace in Config object name MissingNamespace.',
],
// Exceeds length (max length plus an extra dot).
[
str_repeat('a', Config::MAX_NAME_LENGTH) . ".",
'Config object name ' . str_repeat('a', Config::MAX_NAME_LENGTH) . '. exceeds maximum allowed length of ' . Config::MAX_NAME_LENGTH . ' characters.',
],
];
// Name must not contain : ? * < > " ' / \
foreach ([
':',
'?',
'*',
'<',
'>',
'"',
"'",
'/',
'\\',
] as $char) {
$name = 'name.' . $char;
$return[] = [
$name,
"Invalid character in Config object name {$name}.",
];
}
return $return;
}