CodeExplorer createXmlEncoderWithDateTimeNormalizer example
XML;
$document =
new \
DOMDocument();
$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'
);