Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
generateShortcutSet example
\Drupal::
entityTypeManager
(
)
->
getStorage
(
'shortcut'
)
->
resetCache
(
)
;
// Check to ensure that the shortcut weights have changed and that // ShortcutSet::.getShortcuts() returns shortcuts in the new order.
$this
->
assertSame
(
array_reverse
(
array_keys
(
$shortcuts
)
)
,
array_keys
(
$set
->
getShortcuts
(
)
)
)
;
}
/** * Tests switching a user's own shortcut set. */
public
function
testShortcutSetSwitchOwn
(
)
{
$new_set
=
$this
->
generateShortcutSet
(
$this
->
randomMachineName
(
)
)
;
// Attempt to switch the default shortcut set to the newly created shortcut // set.
$this
->
drupalGet
(
'user/' .
$this
->adminUser->
id
(
)
. '/shortcuts'
)
;
$this
->
submitForm
(
[
'set' =>
$new_set
->
id
(
)
]
, 'Change set'
)
;
$this
->
assertSession
(
)
->
statusCodeEquals
(
200
)
;
$current_set
=
shortcut_current_displayed_set
(
$this
->adminUser
)
;
$this
->
assertSame
(
$current_set
->
id
(
)
,
$new_set
->
id
(
)
, 'Successfully switched own shortcut set.'
)
;
}
/** * Tests switching another user's shortcut set. */