function ShortcutTestBase::generateShortcutSet

Creates a generic shortcut set.

7 calls to ShortcutTestBase::generateShortcutSet()
ShortcutSetsTest::testShortcutSetAdd in drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
Tests creating a shortcut set.
ShortcutSetsTest::testShortcutSetAssign in drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
Tests switching another user's shortcut set.
ShortcutSetsTest::testShortcutSetCreateWithSetName in drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
Tests creating a new shortcut set with a defined set name.
ShortcutSetsTest::testShortcutSetDelete in drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
Tests deleting a shortcut set.
ShortcutSetsTest::testShortcutSetRenameAlreadyExists in drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
Tests renaming a shortcut set to the same name as another set.

... See full list

File

drupal/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php, line 84
Definition of Drupal\shortcut\Tests\ShortcutTestBase.

Class

ShortcutTestBase
Defines base class for shortcut test cases.

Namespace

Drupal\shortcut\Tests

Code

function generateShortcutSet($title = '', $default_links = TRUE, $set_name = '') {
  $set = new stdClass();
  $set->title = empty($title) ? $this
    ->randomName(10) : $title;

  // Set name is generated automatically if not set.
  if (!empty($set_name)) {
    $set->set_name = $set_name;
  }
  if ($default_links) {
    $set->links = array();
    $set->links[] = $this
      ->generateShortcutLink('node/add');
    $set->links[] = $this
      ->generateShortcutLink('admin/content');
  }
  shortcut_set_save($set);
  return $set;
}