function ShortcutSetValidationTest::providerInvalidMachineNameCharacters
Same name in other branches
- 10 core/modules/shortcut/tests/src/Kernel/ShortcutSetValidationTest.php \Drupal\Tests\shortcut\Kernel\ShortcutSetValidationTest::providerInvalidMachineNameCharacters()
Shortcut set IDs are atypical: they allow dashes and disallow underscores.
Overrides ConfigEntityValidationTestBase::providerInvalidMachineNameCharacters
File
-
core/
modules/ shortcut/ tests/ src/ Kernel/ ShortcutSetValidationTest.php, line 40
Class
- ShortcutSetValidationTest
- Tests validation of shortcut_set entities.
Namespace
Drupal\Tests\shortcut\KernelCode
public static function providerInvalidMachineNameCharacters() : array {
$cases = parent::providerInvalidMachineNameCharacters();
// Remove the existing test case that verifies a machine name containing
// dashes is invalid.
self::assertSame([
'dash-separated',
FALSE,
], $cases['INVALID: dash separated']);
unset($cases['INVALID: dash separated']);
// And instead add a test case that verifies it is allowed for shortcut
// sets.
$cases['VALID: dash separated'] = [
'dash-separated',
TRUE,
];
// Remove the existing test case that verifies a machine name containing
// underscores is valid.
self::assertSame([
'underscore_separated',
TRUE,
], $cases['VALID: underscore separated']);
unset($cases['VALID: underscore separated']);
// And instead add a test case that verifies it is disallowed for shortcut
// sets.
$cases['INVALID: underscore separated'] = [
'underscore_separated',
FALSE,
];
return $cases;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.