Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CsrfTokenGenerator example
$this
->sessionMetadata =
$this
->
getMockBuilder
(
'Drupal\Core\Session\MetadataBag'
)
->
disableOriginalConstructor
(
)
->
getMock
(
)
;
$settings
=
[
'hash_salt' =>
$this
->
randomMachineName
(
)
,
]
;
new
Settings
(
$settings
)
;
$this
->generator =
new
CsrfTokenGenerator
(
$this
->privateKey,
$this
->sessionMetadata
)
;
}
/** * Set up default expectations on the mocks. */
protected
function
setupDefaultExpectations
(
)
{
$key
= Crypt::
randomBytesBase64
(
)
;
$this
->privateKey->
expects
(
$this
->
any
(
)
)
->
method
(
'get'
)
->
willReturn
(
$key
)
;