Mercurial > hg > rc1
comparison vendor/sabre/vobject/tests/VObject/DocumentTest.php @ 7:430dbd5346f7
vendor sabre as distributed
author | Charlie Root |
---|---|
date | Sat, 13 Jan 2018 09:06:10 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:cec75ba50afc | 7:430dbd5346f7 |
---|---|
1 <?php | |
2 | |
3 namespace Sabre\VObject; | |
4 | |
5 class DocumentTest extends \PHPUnit_Framework_TestCase { | |
6 | |
7 function testGetDocumentType() { | |
8 | |
9 $doc = new MockDocument(); | |
10 $this->assertEquals(Document::UNKNOWN, $doc->getDocumentType()); | |
11 | |
12 } | |
13 | |
14 function testConstruct() { | |
15 | |
16 $doc = new MockDocument('VLIST'); | |
17 $this->assertEquals('VLIST', $doc->name); | |
18 | |
19 } | |
20 | |
21 function testCreateComponent() { | |
22 | |
23 $vcal = new Component\VCalendar(array(), false); | |
24 | |
25 $event = $vcal->createComponent('VEVENT'); | |
26 | |
27 $this->assertInstanceOf('Sabre\VObject\Component\VEvent', $event); | |
28 $vcal->add($event); | |
29 | |
30 $prop = $vcal->createProperty('X-PROP','1234256',array('X-PARAM' => '3')); | |
31 $this->assertInstanceOf('Sabre\VObject\Property', $prop); | |
32 | |
33 $event->add($prop); | |
34 | |
35 unset( | |
36 $event->DTSTAMP, | |
37 $event->UID | |
38 ); | |
39 | |
40 $out = $vcal->serialize(); | |
41 $this->assertEquals("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nX-PROP;X-PARAM=3:1234256\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", $out); | |
42 | |
43 } | |
44 | |
45 function testCreate() { | |
46 | |
47 $vcal = new Component\VCalendar(array(), false); | |
48 | |
49 $event = $vcal->create('VEVENT'); | |
50 $this->assertInstanceOf('Sabre\VObject\Component\VEvent', $event); | |
51 | |
52 $event = $vcal->create('CALSCALE'); | |
53 $this->assertInstanceOf('Sabre\VObject\Property\Text', $event); | |
54 | |
55 } | |
56 | |
57 function testGetClassNameForPropertyValue() { | |
58 | |
59 $vcal = new Component\VCalendar(array(), false); | |
60 $this->assertEquals('Sabre\\VObject\\Property\\Text', $vcal->getClassNameForPropertyValue('TEXT')); | |
61 $this->assertNull($vcal->getClassNameForPropertyValue('FOO')); | |
62 | |
63 } | |
64 | |
65 } | |
66 | |
67 | |
68 class MockDocument extends Document { | |
69 | |
70 } |