comment tag is missing
Hello, when using like this, comment tag is not rendered:
$order_body = XmlWriter::make()
->setXmlStandalone(true)
->write('orders', [
'order' => [
'cod' => '123',
'comment' => 'test comment',
],
]);
"""
<?xml version="1.0" encoding="utf-8"?>\n
<orders>\n
<order>\n
<cod>123</cod>\n
test comment\n
</order>\n
</orders>\n
"""
Should be:
"""
<?xml version="1.0" encoding="utf-8"?>\n
<orders>\n
<order>\n
<cod>123</cod>\n
<comment>test comment</comment>\n
</order>\n
</orders>\n
"""
This is a very very strange one, I wrote a test to replicate this issue and the XML string that XML Wrangler created looked correct, however when I tried to add an assertion, PEST was magically removing the <comment> tag.
I managed to "fix" the test by putting the expected XML into a variable instead of directly referencing it inside of the toBe expectation.
I don't think there is a bug with XML Wrangler here, as it did produce the expected outcome, but I would check your test suite. Do you have any more information you could share?
I was just dumping my output to terminal to see if it is correct. While I was searching why it happened, if I remember correctly, it was something in veewee/xml package. But I did not manage to fix it. For now, just skipping the comment section in output.
I believe the writer uses spatie/array-to-xml and veewee/xml is solely used for reading. Still a very strange issue, because my direct output showed it looked fine, but PEST had the wrong output.