ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
LockedTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAV\Exception;
4 
5 use DOMDocument;
6 use Sabre\DAV;
7 
9 
10  function testSerialize() {
11 
12  $dom = new DOMDocument('1.0');
13  $dom->formatOutput = true;
14  $root = $dom->createElement('d:root');
15 
16  $dom->appendChild($root);
17  $root->setAttribute('xmlns:d', 'DAV:');
18 
19  $lockInfo = new DAV\Locks\LockInfo();
20  $lockInfo->uri = '/foo';
21  $locked = new Locked($lockInfo);
22 
23  $locked->serialize(new DAV\Server(), $root);
24 
25  $output = $dom->saveXML();
26 
27  $expected = '<?xml version="1.0"?>
28 <d:root xmlns:d="DAV:">
29  <d:lock-token-submitted xmlns:d="DAV:">
30  <d:href>/foo</d:href>
31  </d:lock-token-submitted>
32 </d:root>
33 ';
34 
35  $this->assertEquals($expected, $output);
36 
37  }
38 
40 
41  $dom = new DOMDocument('1.0');
42  $dom->formatOutput = true;
43  $root = $dom->createElement('d:root');
44 
45  $dom->appendChild($root);
46  $root->setAttribute('xmlns:d', 'DAV:');
47 
48  $lockInfo = new DAV\Locks\LockInfo();
49  $lockInfo->uri = '/foo&bar';
50  $locked = new Locked($lockInfo);
51 
52  $locked->serialize(new DAV\Server(), $root);
53 
54  $output = $dom->saveXML();
55 
56  $expected = '<?xml version="1.0"?>
57 <d:root xmlns:d="DAV:">
58  <d:lock-token-submitted xmlns:d="DAV:">
59  <d:href>/foo&amp;bar</d:href>
60  </d:lock-token-submitted>
61 </d:root>
62 ';
63 
64  $this->assertEquals($expected, $output);
65 
66  }
67 }
Main DAV server class.
Definition: Server.php:23
$root
Definition: sabredav.php:45
LockInfo class.
Definition: LockInfo.php:15