Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getAppRepository example
$context
= Context::
createDefaultContext
(
)
;
$manifest
=
$this
->
getTestManifest
(
)
;
$this
->
getAppLifecycle
(
)
->
install
(
$manifest
, false,
$context
)
;
$criteria
=
(
new
Criteria
(
)
)
->
addFilter
(
new
EqualsFilter
(
'name', 'test'
)
)
->
addAssociation
(
'acl_role'
)
;
/** @var AppEntity $app */
$app
=
$this
->
getAppRepository
(
)
->
search
(
$criteria
,
$context
)
->
first
(
)
;
// Modify the existing privileges to get a delta
$app
->
setAllowedHosts
(
[
]
)
;
$delta
=
(
new
DomainsDeltaProvider
(
)
)
->
getReport
(
$manifest
,
$app
)
;
static
::
assertCount
(
8,
$delta
)
;
static
::
assertEquals
(
[
'my.app.com',
$context
= Context::
createDefaultContext
(
)
;
$manifest
=
$this
->
getTestManifest
(
)
;
$this
->
getAppLifecycle
(
)
->
install
(
$manifest
, false,
$context
)
;
$criteria
=
(
new
Criteria
(
)
)
->
addFilter
(
new
EqualsFilter
(
'name', 'test'
)
)
->
addAssociation
(
'acl_role'
)
;
/** @var AppEntity $app */
$app
=
$this
->
getAppRepository
(
)
->
search
(
$criteria
,
$context
)
->
first
(
)
;
static
::
assertNotNull
(
$app
->
getAclRole
(
)
)
;
// Modify the existing privileges to get a diff
$app
->
getAclRole
(
)
->
setPrivileges
(
[
'customer:read'
]
)
;
$diff
=
(
new
PermissionsDeltaProvider
(
)
)
->
getReport
(
$manifest
,
$app
)
;
static
::
assertCount
(
6,
$diff
)
;