Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createXmlWithDateTime example
$actualXml
=
$this
->encoder->
encode
(
[
'foo' =>
$document
->
createTextNode
(
'bar'
)
, 'bar' =>
$document
->
createTextNode
(
'foo & bar'
)
]
, 'xml'
)
;
$this
->
assertEquals
(
$expectedXml
,
$actualXml
)
;
}
public
function
testEncodeXmlWithDateTimeObjectValue
(
)
{
$xmlEncoder
=
$this
->
createXmlEncoderWithDateTimeNormalizer
(
)
;
$actualXml
=
$xmlEncoder
->
encode
(
[
'dateTime' =>
new
\
DateTimeImmutable
(
$this
->exampleDateTimeString
)
]
, 'xml'
)
;
$this
->
assertEquals
(
$this
->
createXmlWithDateTime
(
)
,
$actualXml
)
;
}
public
function
testEncodeXmlWithDateTimeObjectField
(
)
{
$xmlEncoder
=
$this
->
createXmlEncoderWithDateTimeNormalizer
(
)
;
$actualXml
=
$xmlEncoder
->
encode
(
[
'foo' =>
[
'@dateTime' =>
new
\
DateTimeImmutable
(
$this
->exampleDateTimeString
)
]
]
, 'xml'
)
;
$this
->
assertEquals
(
$this
->
createXmlWithDateTimeField
(
)
,
$actualXml
)
;
}