public function ShortcutLinksTest::testShortcutLinkOrder in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/shortcut/src/Tests/ShortcutLinksTest.php \Drupal\shortcut\Tests\ShortcutLinksTest::testShortcutLinkOrder()
Tests the shortcuts are correctly ordered by weight in the toolbar.
File
- core/
modules/ shortcut/ src/ Tests/ ShortcutLinksTest.php, line 343 - Contains \Drupal\shortcut\Tests\ShortcutLinksTest.
Class
- ShortcutLinksTest
- Create, view, edit, delete, and change shortcut links.
Namespace
Drupal\shortcut\TestsCode
public function testShortcutLinkOrder() {
// Ensure to give permissions to access the shortcuts.
$this
->drupalLogin($this
->drupalCreateUser(array(
'access toolbar',
'access shortcuts',
'access content overview',
'administer content types',
)));
$this
->drupalGet(Url::fromRoute('<front>'));
$shortcuts = $this
->cssSelect('#toolbar-item-shortcuts-tray .toolbar-menu a');
$this
->assertEqual((string) $shortcuts[0], 'Add content');
$this
->assertEqual((string) $shortcuts[1], 'All content');
foreach ($this->set
->getShortcuts() as $shortcut) {
$shortcut
->setWeight($shortcut
->getWeight() * -1)
->save();
}
$this
->drupalGet(Url::fromRoute('<front>'));
$shortcuts = $this
->cssSelect('#toolbar-item-shortcuts-tray .toolbar-menu a');
$this
->assertEqual((string) $shortcuts[0], 'All content');
$this
->assertEqual((string) $shortcuts[1], 'Add content');
}