/** * test search nodes by attribute name */ public function testSearchByAttributeAccess() { $xml = new Xml(); $root = $xml->createElement('root'); $testNode = $xml->createElement('test'); $testNode->setAttribute('attr', 'a'); $root->appendChild($testNode); $testNode = $xml->createElement('test'); $testNode->setAttribute('attr', 'b'); $root->appendChild($testNode); $testNode = $xml->createElement('test'); $testNode->setAttribute('attr', 'c'); $root->appendChild($testNode); $xml->appendChild($root); $list = $xml->searchByAttribute($xml->childNodes, 'attr'); $this->assertArrayHasKey('a', $list); $this->assertArrayHasKey('b', $list); $this->assertArrayHasKey('c', $list); }