public function testGetXmlValueException() { $xml = new SimpleXMLElement('<root><child a="b">foo</child><child a="c">bar</child></root>'); try { $r = $this->builder->getXmlValue($xml, '//child'); } catch (Exception $e) { $this->assertStringStartsWith('Too many elements for', $e->getMessage()); return; } $this->fail('No exception thrown.'); }