1<?php
2
3namespace Sabre\VObject;
4
5class WriterTest extends \PHPUnit_Framework_TestCase {
6
7    function getComponent() {
8
9        $data = "BEGIN:VCALENDAR\r\nEND:VCALENDAR";
10        return Reader::read($data);
11
12    }
13
14    function testWriteToMimeDir() {
15
16        $result = Writer::write($this->getComponent());
17        $this->assertEquals("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n", $result);
18
19    }
20
21    function testWriteToJson() {
22
23        $result = Writer::writeJson($this->getComponent());
24        $this->assertEquals('["vcalendar",[],[]]', $result);
25
26    }
27
28    function testWriteToXml() {
29
30        $result = Writer::writeXml($this->getComponent());
31        $this->assertEquals(
32            '<?xml version="1.0" encoding="UTF-8"?>' . "\n" .
33            '<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">' . "\n" .
34            ' <vcalendar/>' . "\n" .
35            '</icalendar>' . "\n",
36            $result
37        );
38
39    }
40
41}
42