| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function testXpath() |
||
| 27 | { |
||
| 28 | $reader = new XmlReader(new \SplFileObject('tests/metadata/testfiles/hierarchicaldata-xml.xml'), "/root/node[@attr2='b']"); |
||
| 29 | |||
| 30 | $this->assertEquals(1, count($reader)); |
||
| 31 | $this->assertEquals(array('attr2'), $reader->getFields()); |
||
| 32 | $this->assertEquals(array('value1'=>'2', '@attributes'=>array('attr2'=>'b')), $reader->current()); |
||
| 33 | |||
| 34 | $actualData = array(); |
||
| 35 | $expectedData = array( |
||
| 36 | array('value1'=>'2', '@attributes'=>array('attr2'=>'b')) |
||
| 37 | ); |
||
| 38 | foreach ($reader as $key=>$row) { |
||
| 39 | $actualData[] = $row; |
||
| 40 | } |
||
| 41 | $this->assertEquals($expectedData, $actualData); |
||
| 42 | } |
||
| 43 | |||
| 45 |