diff --git a/cake/libs/xml.php b/cake/libs/xml.php
index c55fddfae..3f6dd1e1c 100644
--- a/cake/libs/xml.php
+++ b/cake/libs/xml.php
@@ -106,7 +106,7 @@ class Xml {
* @param string $format If create childs ('tags') or attributes ('attribute').
* @return object SimpleXMLElement
*/
- public static function fromArray($input, $format = 'attribute') {
+ public static function fromArray($input, $format = 'tags') {
if (!is_array($input) || count($input) !== 1) {
throw new Exception(__('Invalid input.'));
}
diff --git a/cake/tests/cases/libs/xml.test.php b/cake/tests/cases/libs/xml.test.php
index 74dcb464c..80c06a7d8 100644
--- a/cake/tests/cases/libs/xml.test.php
+++ b/cake/tests/cases/libs/xml.test.php
@@ -115,14 +115,14 @@ class XmlTest extends CakeTestCase {
)
)
);
- $obj = Xml::fromArray($xml);
+ $obj = Xml::fromArray($xml, 'attributes');
$this->assertTrue($obj instanceof SimpleXMLElement);
$this->assertEqual($obj->getName(), 'tags');
$this->assertEqual(count($obj), 2);
$xmlText = '<' . '?xml version="1.0"?>';
$this->assertEqual(str_replace(array("\r", "\n"), '', $obj->asXML()), $xmlText);
- $obj = Xml::fromArray($xml, 'tags');
+ $obj = Xml::fromArray($xml);
$this->assertTrue($obj instanceof SimpleXMLElement);
$this->assertEqual($obj->getName(), 'tags');
$this->assertEqual(count($obj), 2);
@@ -202,7 +202,7 @@ class XmlTest extends CakeTestCase {
)
)
);
- $obj = Xml::fromArray($xml);
+ $obj = Xml::fromArray($xml, 'attributes');
$xmlText = '<' . '?xml version="1.0"?>defect';
$this->assertEqual(str_replace(array("\r", "\n"), '', $obj->asXML()), $xmlText);
}
@@ -318,8 +318,8 @@ class XmlTest extends CakeTestCase {
)
)
);
- $this->assertEqual(Xml::toArray(Xml::fromArray($array)), $expected);
- $this->assertEqual(Xml::toArray(Xml::fromArray($array, 'tags')), $array);
+ $this->assertEqual(Xml::toArray(Xml::fromArray($array, 'attributes')), $expected);
+ $this->assertEqual(Xml::toArray(Xml::fromArray($array)), $array);
$array = array(
'tags' => array(
@@ -353,7 +353,7 @@ class XmlTest extends CakeTestCase {
)
)
);
- $this->assertEqual(Xml::toArray(Xml::fromArray($array)), $expected);
+ $this->assertEqual(Xml::toArray(Xml::fromArray($array, 'attributes')), $expected);
$xml = '';
$xml .= 'defect';