/** * * @param XmlElement $xml */ public function parseAttributes($xml) { $this->attributes = $xml->getAttributes(); foreach ($this->attributes as $name => $value) { $key = strtolower(trim($name)); $this->attributesMap[$key] = $name; } }
public function testGetAttributes() { $xml = '<element greeting="hello" subject="world" />'; $element = new XmlElement($xml); $result = $element->getAttributes(); $this->assertNotNull($result); $this->assertNotEmpty($result); $this->assertEquals(array('greeting' => 'hello', 'subject' => 'world'), $result); }