function ConfigTest::validateNameProvider
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::validateNameProvider()
- 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::validateNameProvider()
- 11.x 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 432
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.