/** * @dataProvider getData */ public function testAttributePathResultsInTheFirstTwoValuesReadCorrectly($data) { $xmlParser = new Parser(); $values = array(); $callback = function ($parser, $val) use(&$values) { $values[] = $val; }; $xmlParser->registerCallback('/rss/channel/item/category/@domain', $callback); $xmlParser->parse($data); $this->assertEquals(array('http://www.guardian.co.uk/publication', 'http://www.guardian.co.uk/world'), array($values[0], $values[1])); }
/** * @return Parser * @throws \Exception */ private function createXmlParser() { $xmlParser = new Parser(); return $xmlParser->registerCallback('/teryt/catalog/row', $this->getNodeParserCallbackFunction()); }