ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
InviteTest.php
Go to the documentation of this file.
1<?php
2
4
8
9class InviteTest extends XmlTest {
10
11 function testSerialize() {
12
13 $sharees = [
14 new Sharee(),
15 new Sharee(),
16 new Sharee(),
17 new Sharee()
18 ];
19 $sharees[0]->href = 'mailto:foo@example.org';
20 $sharees[0]->properties['{DAV:}displayname'] = 'Foo Bar';
21 $sharees[0]->access = Plugin::ACCESS_SHAREDOWNER;
22 $sharees[0]->inviteStatus = Plugin::INVITE_ACCEPTED;
23
24 $sharees[1]->href = 'mailto:bar@example.org';
25 $sharees[1]->access = Plugin::ACCESS_READ;
26 $sharees[1]->inviteStatus = Plugin::INVITE_DECLINED;
27
28 $sharees[2]->href = 'mailto:baz@example.org';
29 $sharees[2]->access = Plugin::ACCESS_READWRITE;
30 $sharees[2]->inviteStatus = Plugin::INVITE_NORESPONSE;
31
32 $sharees[3]->href = 'mailto:zim@example.org';
33 $sharees[3]->access = Plugin::ACCESS_READWRITE;
34 $sharees[3]->inviteStatus = Plugin::INVITE_INVALID;
35
36 $invite = new Invite($sharees);
37
38 $xml = $this->write(['{DAV:}root' => $invite]);
39
40 $expected = <<<XML
41<?xml version="1.0"?>
42<d:root xmlns:d="DAV:">
43<d:sharee>
44 <d:href>mailto:foo@example.org</d:href>
45 <d:prop>
46 <d:displayname>Foo Bar</d:displayname>
47 </d:prop>
48 <d:share-access><d:shared-owner /></d:share-access>
49 <d:invite-accepted/>
50</d:sharee>
51<d:sharee>
52 <d:href>mailto:bar@example.org</d:href>
53 <d:prop />
54 <d:share-access><d:read /></d:share-access>
55 <d:invite-declined/>
56</d:sharee>
57<d:sharee>
58 <d:href>mailto:baz@example.org</d:href>
59 <d:prop />
60 <d:share-access><d:read-write /></d:share-access>
61 <d:invite-noresponse/>
62</d:sharee>
63<d:sharee>
64 <d:href>mailto:zim@example.org</d:href>
65 <d:prop />
66 <d:share-access><d:read-write /></d:share-access>
67 <d:invite-invalid/>
68</d:sharee>
69</d:root>
70XML;
71
72 $this->assertXmlStringEqualsXmlString($expected, $xml);
73
74 }
75
76}
An exception for terminatinating execution or to throw for unit testing.
This plugin implements HTTP requests and properties related to:
Definition: Plugin.php:27
This class represents the {DAV:}sharee element.
Definition: Sharee.php:21
This class represents the {DAV:}invite property.
Definition: Invite.php:23