Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
UnstructuredObjectBusinessEvent example
public
static
function
getEvents
(
)
: \Generator
{
$tax
=
new
TaxEntity
(
)
;
$tax
->
setId
(
'tax-id'
)
;
$tax
->
setName
(
'test'
)
;
$tax
->
setTaxRate
(
19
)
;
$tax
->
setPosition
(
1
)
;
yield
'ScalarBusinessEvent' =>
[
new
ScalarBusinessEvent
(
)
]
;
yield
'StructuredObjectBusinessEvent' =>
[
new
StructuredObjectBusinessEvent
(
)
]
;
yield
'StructuredArrayObjectBusinessEvent' =>
[
new
StructuredArrayObjectBusinessEvent
(
)
]
;
yield
'UnstructuredObjectBusinessEvent' =>
[
new
UnstructuredObjectBusinessEvent
(
)
]
;
yield
'EntityBusinessEvent' =>
[
new
EntityBusinessEvent
(
$tax
)
]
;
yield
'CollectionBusinessEvent' =>
[
new
CollectionBusinessEvent
(
new
TaxCollection
(
[
$tax
]
)
)
]
;
yield
'ArrayBusinessEvent' =>
[
new
ArrayBusinessEvent
(
new
TaxCollection
(
[
$tax
]
)
)
]
;
yield
'NestedEntityBusinessEvent' =>
[
new
NestedEntityBusinessEvent
(
$tax
)
]
;
}
public
function
testInvalidType
(
)
: void
{
static
::
expectException
(
\RuntimeException::
class
)
;
$this
->businessEventEncoder->
encode
(
new
InvalidTypeBusinessEvent
(
)
)
;
}
ProductDefinition::ENTITY_NAME . ':' . AclRoleDefinition::PRIVILEGE_READ,
]
)
;
static
::
assertFalse
(
$event
->
isAllowed
(
Uuid::
randomHex
(
)
,
$notAllowedPermissions
)
)
;
}
public
static
function
getEventsWithoutPermissions
(
)
: array
{
return
[
[
new
ScalarBusinessEvent
(
)
]
,
[
new
StructuredObjectBusinessEvent
(
)
]
,
[
new
StructuredArrayObjectBusinessEvent
(
)
]
,
[
new
UnstructuredObjectBusinessEvent
(
)
]
,
]
;
}
public
static
function
getEventsWithPermissions
(
)
: array
{
$tax
=
new
TaxEntity
(
)
;
$tax
->
setId
(
'tax-id'
)
;
$tax
->
setName
(
'test'
)
;
$tax
->
setTaxRate
(
19
)
;
$tax
->
setPosition
(
1
)
;