9 use \Magento\Framework\Convert\ConvertArray;
25 $data = [
'one' => 1,
'two' => [
'three' => 3,
'four' =>
'4']];
27 $expectedResult = <<<XML
28 <?xml version=
"1.0" encoding=
"UTF-8" standalone=
"yes"?>
29 <_><one>1</one><two><three>3</three><four>4</four></two></_>
32 $this->assertInstanceOf(
'SimpleXMLElement',
$result);
33 $this->assertEquals($expectedResult,
$result->asXML());
48 $this->_model->assocToXml(
$data);
59 $this->_model->assocToXml($array, $rootName);
66 'key2' => [
'key21' =>
'value21',
'key22' =>
'value22',
'key23' => [
'key231' =>
'value231']],
67 'key3' => [
'key31' =>
'value31',
'key3' =>
'value3'],
68 'key4' => [
'key4' =>
'value4'],
74 'key231' =>
'value231',
80 $this->assertEquals($expectedOutput,
$output,
'Array is converted to flat structure incorrectly.');
88 return [[[],
''], [[], 0], [[1, 2, 3]], [[
'root' => 1],
'root']];
testAssocToXmlExceptionByKey()
assocToXmlExceptionDataProvider()
testAssocToXmlException($array, $rootName='_')
static toFlatArray($data)