ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
RepeatingElementsTest.php
Go to the documentation of this file.
1<?php
2
4
6
8
9 function testRead() {
10
11 $service = new Service();
12 $service->elementMap['{urn:test}collection'] = function($reader) {
13 return repeatingElements($reader, '{urn:test}item');
14 };
15
16 $xml = <<<XML
17<?xml version="1.0"?>
18<collection xmlns="urn:test">
19 <item>foo</item>
20 <item>bar</item>
21</collection>
22XML;
23
24 $result = $service->parse($xml);
25
26 $expected = [
27 'foo',
28 'bar',
29 ];
30
31 $this->assertEquals($expected, $result);
32
33 }
34
35}
$result
An exception for terminatinating execution or to throw for unit testing.
XML parsing and writing service.
Definition: Service.php:16
repeatingElements(Reader $reader, $childElementName)
This deserializer helps you deserialize xml structures that look like this:
Definition: functions.php:241