ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
RepeatingElementsTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\Xml\Serializer;
4 
6 
8 
9  function testSerialize() {
10 
11  $service = new Service();
12  $service->namespaceMap['urn:test'] = null;
13  $xml = $service->write('{urn:test}collection', function($writer) {
14  repeatingElements($writer, [
15  'foo',
16  'bar',
17  ], '{urn:test}item');
18  });
19 
20  $expected = <<<XML
21 <?xml version="1.0"?>
22 <collection xmlns="urn:test">
23  <item>foo</item>
24  <item>bar</item>
25 </collection>
26 XML;
27 
28 
29  $this->assertXmlStringEqualsXmlString($expected, $xml);
30 
31 
32  }
33 
34 
35 }
repeatingElements(Writer $writer, array $items, $childElementName)
This serializer helps you serialize xml structures that look like this:
Definition: functions.php:97
XML parsing and writing service.
Definition: Service.php:16