public function ShortcutTestBase::generateShortcutSet in Drupal 10
Same name and namespace in other branches
- 8 core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
- 9 core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
Creates a generic shortcut set.
File
- core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutTestBase.php, line 111
Class
- ShortcutTestBase
- Defines base class for shortcut test cases.
Namespace
Drupal\Tests\shortcut\FunctionalCode
public function generateShortcutSet($label = '', $id = NULL) {
$set = ShortcutSet::create([
'id' => $id ?? strtolower($this
->randomMachineName()),
'label' => empty($label) ? $this
->randomString() : $label,
]);
$set
->save();
return $set;
}