ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
WriterTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\VObject;
4
5use PHPUnit\Framework\TestCase;
6
7class WriterTest extends TestCase {
8
9 function getComponent() {
10
11 $data = "BEGIN:VCALENDAR\r\nEND:VCALENDAR";
12 return Reader::read($data);
13
14 }
15
16 function testWriteToMimeDir() {
17
19 $this->assertEquals("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n", $result);
20
21 }
22
23 function testWriteToJson() {
24
26 $this->assertEquals('["vcalendar",[],[]]', $result);
27
28 }
29
30 function testWriteToXml() {
31
33 $this->assertEquals(
34 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
35 '<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">' . "\n" .
36 ' <vcalendar/>' . "\n" .
37 '</icalendar>' . "\n",
39 );
40
41 }
42
43}
$result
An exception for terminatinating execution or to throw for unit testing.
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
static write(Component $component)
Serializes a vCard or iCalendar object.
Definition: Writer.php:26
static writeJson(Component $component, $options=0)
Serializes a jCal or jCard object.
Definition: Writer.php:40
static writeXml(Component $component)
Serializes a xCal or xCard object.
Definition: Writer.php:53
$data
Definition: bench.php:6