Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setSubClasses example
]
;
$subStruct
=
new
TestStruct
(
)
;
$subStruct
->
setFoo
(
'wusel'
)
;
$subStruct2
=
new
TestStruct
(
)
;
$subStruct2
->
setFoo
(
'gusel'
)
;
$struct
=
new
AdvancedTestStruct
(
)
;
$struct
->
setFoo
(
'bar'
)
;
$struct
->
setSubClasses
(
[
$subStruct
,
$subStruct2
]
)
;
$struct
->
setMeta
(
[
'keyA' => 'valueA', 'keyB' => 'valueB'
]
)
;
static
::
assertEquals
(
$struct
,
$this
->normalizer->
denormalize
(
$structNormalized
)
)
;
}
public
function
testDenormalizeWithNonExistingClass
(
)
: void
{
$this
->
expectException
(
InvalidArgumentException::
class
)
;
$this
->
expectExceptionMessage
(
'Class "ThisClass\DoesNot\Exists" does not exist'
)
;
$this
->normalizer->
denormalize
(
[
'_class' => 'ThisClass\DoesNot\Exists'
]
)
;
}