ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\JCalTest Class Reference
+ Inheritance diagram for Sabre\VObject\JCalTest:
+ Collaboration diagram for Sabre\VObject\JCalTest:

Public Member Functions

 testToJCal ()
 

Detailed Description

Definition at line 7 of file JCalTest.php.

Member Function Documentation

◆ testToJCal()

Sabre\VObject\JCalTest::testToJCal ( )

Definition at line 9 of file JCalTest.php.

References Sabre\VObject\Version\VERSION.

9  {
10 
11  $cal = new Component\VCalendar();
12 
13  $event = $cal->add('VEVENT', [
14  "UID" => "foo",
15  "DTSTART" => new \DateTime("2013-05-26 18:10:00Z"),
16  "DURATION" => "P1D",
17  "CATEGORIES" => ['home', 'testing'],
18  "CREATED" => new \DateTime("2013-05-26 18:10:00Z"),
19 
20  "ATTENDEE" => "mailto:armin@example.org",
21  "GEO" => [51.96668, 7.61876],
22  "SEQUENCE" => 5,
23  "FREEBUSY" => ["20130526T210213Z/PT1H", "20130626T120000Z/20130626T130000Z"],
24  "URL" => "http://example.org/",
25  "TZOFFSETFROM" => "+0500",
26  "RRULE" => ['FREQ' => 'WEEKLY', 'BYDAY' => ['MO', 'TU']],
27  ], false);
28 
29  // Modifying DTSTART to be a date-only.
30  $event->dtstart['VALUE'] = 'DATE';
31  $event->add("X-BOOL", true, ['VALUE' => 'BOOLEAN']);
32  $event->add("X-TIME", "08:00:00", ['VALUE' => 'TIME']);
33  $event->add("ATTACH", "attachment", ['VALUE' => 'BINARY']);
34  $event->add("ATTENDEE", "mailto:dominik@example.org", ["CN" => "Dominik", "PARTSTAT" => "DECLINED"]);
35 
36  $event->add('REQUEST-STATUS', ["2.0", "Success"]);
37  $event->add('REQUEST-STATUS', ["3.7", "Invalid Calendar User", "ATTENDEE:mailto:jsmith@example.org"]);
38 
39  $event->add('DTEND', '20150108T133000');
40 
41  $expected = [
42  "vcalendar",
43  [
44  [
45  "version",
46  new \StdClass(),
47  "text",
48  "2.0"
49  ],
50  [
51  "prodid",
52  new \StdClass(),
53  "text",
54  "-//Sabre//Sabre VObject " . Version::VERSION . "//EN",
55  ],
56  [
57  "calscale",
58  new \StdClass(),
59  "text",
60  "GREGORIAN"
61  ],
62  ],
63  [
64  ["vevent",
65  [
66  [
67  "uid", new \StdClass(), "text", "foo",
68  ],
69  [
70  "dtstart", new \StdClass(), "date", "2013-05-26",
71  ],
72  [
73  "duration", new \StdClass(), "duration", "P1D",
74  ],
75  [
76  "categories", new \StdClass(), "text", "home", "testing",
77  ],
78  [
79  "created", new \StdClass(), "date-time", "2013-05-26T18:10:00Z",
80  ],
81  [
82  "attendee", new \StdClass(), "cal-address", "mailto:armin@example.org",
83  ],
84  [
85  "attendee",
86  (object)[
87  "cn" => "Dominik",
88  "partstat" => "DECLINED",
89  ],
90  "cal-address",
91  "mailto:dominik@example.org"
92  ],
93  [
94  "geo", new \StdClass(), "float", [51.96668, 7.61876],
95  ],
96  [
97  "sequence", new \StdClass(), "integer", 5
98  ],
99  [
100  "freebusy", new \StdClass(), "period", ["2013-05-26T21:02:13", "PT1H"], ["2013-06-26T12:00:00", "2013-06-26T13:00:00"],
101  ],
102  [
103  "url", new \StdClass(), "uri", "http://example.org/",
104  ],
105  [
106  "tzoffsetfrom", new \StdClass(), "utc-offset", "+05:00",
107  ],
108  [
109  "rrule", new \StdClass(), "recur", [
110  'freq' => 'WEEKLY',
111  'byday' => ['MO', 'TU'],
112  ],
113  ],
114  [
115  "x-bool", new \StdClass(), "boolean", true
116  ],
117  [
118  "x-time", new \StdClass(), "time", "08:00:00",
119  ],
120  [
121  "attach", new \StdClass(), "binary", base64_encode('attachment')
122  ],
123  [
124  "request-status",
125  new \StdClass(),
126  "text",
127  ["2.0", "Success"],
128  ],
129  [
130  "request-status",
131  new \StdClass(),
132  "text",
133  ["3.7", "Invalid Calendar User", "ATTENDEE:mailto:jsmith@example.org"],
134  ],
135  [
136  'dtend',
137  new \StdClass(),
138  "date-time",
139  "2015-01-08T13:30:00",
140  ],
141  ],
142  [],
143  ]
144  ],
145  ];
146 
147  $this->assertEquals($expected, $cal->jsonSerialize());
148 
149  }
const VERSION
Full version number.
Definition: Version.php:17

The documentation for this class was generated from the following file: