You are here

function ShortcutTestBase::generateShortcutSet in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/shortcut/src/Tests/ShortcutTestBase.php \Drupal\shortcut\Tests\ShortcutTestBase::generateShortcutSet()

Creates a generic shortcut set.

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

File

core/modules/shortcut/src/Tests/ShortcutTestBase.php, line 101
Contains \Drupal\shortcut\Tests\ShortcutTestBase.

Class

ShortcutTestBase
Defines base class for shortcut test cases.

Namespace

Drupal\shortcut\Tests

Code

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