Skip to content

Commit

Permalink
Merge pull request #13 from mindbox-moscow/fix/booleanValuesInXML
Browse files Browse the repository at this point in the history
correct boolean values in XML
  • Loading branch information
QSOFT-DEVOLOPER authored May 6, 2019
2 parents f71bab8 + 7743a21 commit 7dd8fc6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/XMLHelper/MindboxXMLSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ private static function getXML(&$xml, array $data)
if (is_array($value)) {
$subNode = $xml->addChild($key);
self::getXML($subNode, $value);
} elseif (is_bool($value)) {
$xml->addChild($key, var_export($value, true));
} else {
$xml->addChild($key, $value);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/DTO/DTOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ public function asXmlFieldsProvider()
'someDtoField' => $this->getDto(['dto' => 'value']),
],
'<?xml version="1.0" encoding="utf-8"?>
<' . $this->getXmlName() . '><name>Andrew</name><age>33</age><someField>1</someField><someArrayField><field>value</field></someArrayField><someDtoField><dto>value</dto></someDtoField></' . $this->getXmlName() . '>
<' . $this->getXmlName() . '><name>Andrew</name><age>33</age><someField>true</someField><someArrayField><field>value</field></someArrayField><someDtoField><dto>value</dto></someDtoField></' . $this->getXmlName() . '>
',
],
[
['name' => 'Andrew', 'age' => 33, 'someField' => true, 33 => '345'],
'<?xml version="1.0" encoding="utf-8"?>
<' . $this->getXmlName() . '><name>Andrew</name><age>33</age><someField>1</someField><value>345</value></' . $this->getXmlName() . '>
<' . $this->getXmlName() . '><name>Andrew</name><age>33</age><someField>true</someField><value>345</value></' . $this->getXmlName() . '>
',
],
[
Expand Down

0 comments on commit 7dd8fc6

Please sign in to comment.