Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
requiresRenewedConsent example
static
::
assertCount
(
2,
$deltas
)
;
static
::
assertArrayHasKey
(
'permissions',
$deltas
)
;
static
::
assertCount
(
6,
$deltas
[
'permissions'
]
)
;
static
::
assertArrayHasKey
(
'domains',
$deltas
)
;
static
::
assertCount
(
8,
$deltas
[
'domains'
]
)
;
}
public
function
testRequiresRenewedConsent
(
)
: void
{
$appConfirmationDeltaProvider
=
$this
->
getAppConfirmationDeltaProvider
(
)
;
$requiresRenewedConsent
=
$appConfirmationDeltaProvider
->
requiresRenewedConsent
(
$this
->
getTestManifest
(
)
,
new
AppEntity
(
)
)
;
static
::
assertTrue
(
$requiresRenewedConsent
)
;
}
private
function
getTestManifest
(
)
: Manifest
{
return
Manifest::
createFromXmlFile
(
__DIR__ . '/../Manifest/_fixtures/test/manifest.xml'
)
;
}
public
function
updateExtension
(
string
$technicalName
, bool
$allowNewPermissions
, Context
$context
)
: void
{
$manifests
=
$this
->appLoader->
load
(
)
;
if
(
!\
array_key_exists
(
$technicalName
,
$manifests
)
)
{
throw
StoreException::
extensionInstallException
(
'Cannot find extension'
)
;
}
$app
=
$this
->
getAppByName
(
$technicalName
,
$context
)
;
$requiresRenewedConsent
=
$this
->appDeltaService->
requiresRenewedConsent
(
$manifests
[
$technicalName
]
,
$app
)
;
if
(
!
$allowNewPermissions
&&
$requiresRenewedConsent
)
{
$deltas
=
$this
->appDeltaService->
getReports
(
$manifests
[
$technicalName
]
,
$app
)
;
throw
StoreException::
extensionUpdateRequiresConsentAffirmationException
(
$technicalName
,
$deltas
)
;
}