ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
InviteReplyTest.php
Go to the documentation of this file.
1<?php
2
4
5use Sabre\DAV;
7
8class InviteReplyTest extends XmlTest {
9
10 protected $elementMap = [
11 '{http://calendarserver.org/ns/}invite-reply' => 'Sabre\\CalDAV\\Xml\\Request\\InviteReply',
12 ];
13
14 function testDeserialize() {
15
16 $xml = <<<XML
17<?xml version="1.0"?>
18<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
19 <d:href>/principal/1</d:href>
20 <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
21 <cs:invite-accepted />
22 <cs:in-reply-to>blabla</cs:in-reply-to>
23 <cs:summary>Summary</cs:summary>
24</cs:invite-reply>
25XML;
26
27 $result = $this->parse($xml);
28 $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_ACCEPTED);
29
30 $this->assertEquals(
31 $inviteReply,
32 $result['value']
33 );
34
35 }
36
38
39 $xml = <<<XML
40<?xml version="1.0"?>
41<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
42 <d:href>/principal/1</d:href>
43 <cs:hosturl><d:href>/calendar/1</d:href></cs:hosturl>
44 <cs:invite-declined />
45 <cs:in-reply-to>blabla</cs:in-reply-to>
46 <cs:summary>Summary</cs:summary>
47</cs:invite-reply>
48XML;
49
50 $result = $this->parse($xml);
51 $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_DECLINED);
52
53 $this->assertEquals(
54 $inviteReply,
55 $result['value']
56 );
57
58 }
59
64
65 $xml = <<<XML
66<?xml version="1.0"?>
67<cs:invite-reply xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:">
68 <d:href>/principal/1</d:href>
69 <cs:invite-declined />
70 <cs:in-reply-to>blabla</cs:in-reply-to>
71 <cs:summary>Summary</cs:summary>
72</cs:invite-reply>
73XML;
74
75 $this->parse($xml);
76
77 }
78}
$result
An exception for terminatinating execution or to throw for unit testing.
testDeserializeNoHostUrl()
@expectedException \Sabre\DAV\Exception\BadRequest
Invite-reply POST request parser.
Definition: InviteReply.php:24
parse($xml, array $elementMap=[])
Definition: XmlTest.php:26