You are here

function ShortcutSetsTest::testShortcutSetAdd in Zircon Profile 8

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

Tests creating a shortcut set.

File

core/modules/shortcut/src/Tests/ShortcutSetsTest.php, line 38
Contains \Drupal\shortcut\Tests\ShortcutSetsTest.

Class

ShortcutSetsTest
Create, view, edit, delete, and change shortcut sets.

Namespace

Drupal\shortcut\Tests

Code

function testShortcutSetAdd() {
  $this
    ->drupalGet('admin/config/user-interface/shortcut');
  $this
    ->clickLink(t('Add shortcut set'));
  $edit = array(
    'label' => $this
      ->randomMachineName(),
    'id' => strtolower($this
      ->randomMachineName()),
  );
  $this
    ->drupalPostForm(NULL, $edit, t('Save'));
  $new_set = $this->container
    ->get('entity.manager')
    ->getStorage('shortcut_set')
    ->load($edit['id']);
  $this
    ->assertIdentical($new_set
    ->id(), $edit['id'], 'Successfully created a shortcut set.');
  $this
    ->drupalGet('user/' . $this->adminUser
    ->id() . '/shortcuts');
  $this
    ->assertText($new_set
    ->label(), 'Generated shortcut set was listed as a choice on the user account page.');
}