Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
StoreRequestOptionsProvider example
class
StoreRequestOptionsProviderTest
extends
TestCase
{
public
function
testGetAuthenticationHeaderContainsShopSecretIfExists
(
)
: void
{
$systemConfigService
=
static
::
createMock
(
SystemConfigService::
class
)
;
$systemConfigService
->
expects
(
static
::
once
(
)
)
->
method
(
'getString'
)
->
with
(
'core.store.shopSecret'
)
->
willReturn
(
'store-secret'
)
;
$provider
=
new
StoreRequestOptionsProvider
(
$this
->
configureUserRepositorySearchMock
(
new
UserCollection
(
)
,
static
::
once
(
)
)
,
$systemConfigService
,
new
InstanceService
(
'sw-version', 'instance-id'
)
,
static
::
createMock
(
LocaleProvider::
class
)
)
;
$authHeaders
=
$provider
->
getAuthenticationHeader
(
Context::
createDefaultContext
(
new
AdminApiSource
(
'user-id'
)
)
)
;
static
::
assertArrayHasKey
(
'X-Shopware-Shop-Secret',
$authHeaders
)
;