function ShortcutTestBase::generateShortcutSet

Same name in other branches
  1. 9 core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
  2. 8.9.x core/modules/shortcut/src/Tests/ShortcutTestBase.php \Drupal\shortcut\Tests\ShortcutTestBase::generateShortcutSet()
  3. 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
  4. 11.x core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()

Creates a generic shortcut set.

6 calls to ShortcutTestBase::generateShortcutSet()
ShortcutSetsTest::testShortcutSetAssign in core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
Tests switching another user's shortcut set.
ShortcutSetsTest::testShortcutSetCreateWithSetName in core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
Tests creating a new shortcut set with a defined set name.
ShortcutSetsTest::testShortcutSetDelete in core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
Tests deleting a shortcut set.
ShortcutSetsTest::testShortcutSetSwitchOwn in core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
Tests switching a user's own shortcut set.
ShortcutSetsTest::testShortcutSetUnassign in core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
Tests un-assigning a shortcut set.

... See full list

File

core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php, line 114

Class

ShortcutTestBase
Defines base class for shortcut test cases.

Namespace

Drupal\Tests\shortcut\Functional

Code

public function generateShortcutSet($label = '', $id = NULL) {
    $set = ShortcutSet::create([
        'id' => $id ?? $this->randomMachineName(),
        'label' => empty($label) ? $this->randomString() : $label,
    ]);
    $set->save();
    return $set;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.