function ShortcutSetsTest::testShortcutSetSwitchNoSetName

Same name in other branches
  1. 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetSwitchNoSetName()
  2. 10 core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetSwitchNoSetName()
  3. 11.x core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php \Drupal\Tests\shortcut\Functional\ShortcutSetsTest::testShortcutSetSwitchNoSetName()

Tests switching a user's shortcut set without providing a new set name.

File

core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php, line 149

Class

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

Namespace

Drupal\Tests\shortcut\Functional

Code

public function testShortcutSetSwitchNoSetName() {
    $edit = [
        'set' => 'new',
    ];
    $this->drupalGet('user/' . $this->adminUser
        ->id() . '/shortcuts');
    $this->submitForm($edit, 'Change set');
    $this->assertSession()
        ->pageTextContains('The new set label is required.');
    $current_set = shortcut_current_displayed_set($this->adminUser);
    $this->assertEquals($this->set
        ->id(), $current_set->id(), 'Attempting to switch to a new shortcut set without providing a set name does not succeed.');
    $field = $this->assertSession()
        ->fieldExists('label');
    $this->assertTrue($field->hasClass('error'));
}

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