1<?php
2
3namespace Sabre\Xml\Serializer;
4
5use Sabre\Xml\Service;
6
7class RepeatingElementsTest extends \PHPUnit_Framework_TestCase {
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>
26XML;
27
28
29        $this->assertXmlStringEqualsXmlString($expected, $xml);
30
31
32    }
33
34
35}
36