Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
StructWithCustomFields example
static
::
assertArrayHasKey
(
'name',
$encoded
)
;
static
::
assertArrayNotHasKey
(
'description',
$encoded
)
;
static
::
assertArrayHasKey
(
'translated',
$encoded
)
;
static
::
assertArrayHasKey
(
'name',
$encoded
[
'translated'
]
)
;
static
::
assertArrayNotHasKey
(
'description',
$encoded
[
'translated'
]
)
;
}
public
function
testStructWithCustomFields
(
)
: void
{
$struct
=
new
StructWithCustomFields
(
)
;
$response
=
$this
->encoder->
encode
(
$struct
,
new
ResponseFields
(
null
)
)
;
static
::
assertNull
(
$response
[
'customFields'
]
)
;
$struct
=
new
StructWithCustomFields
(
)
;
$struct
->
setCustomFields
(
[
]
)
;
$response
=
$this
->encoder->
encode
(
$struct
,
new
ResponseFields
(
null
)
)
;
static
::
assertInstanceOf
(
\stdClass::
class
,
$response
[
'customFields'
]
)
;
$struct
=
new
StructWithCustomFields
(
)
;
$struct
->
setCustomFields
(
[
'bla' => 'test'
]
)
;
$response
=
$this
->encoder->
encode
(
$struct
,
new
ResponseFields
(
null
)
)
;