コード例 #1
0
ファイル: DocumentTest.php プロジェクト: TamirAl/hubzilla
 function testCreateComponent()
 {
     $vcal = new Component\VCalendar();
     $event = $vcal->createComponent('VEVENT');
     $this->assertInstanceOf('Sabre\\VObject\\Component\\VEvent', $event);
     $vcal->add($event);
     $prop = $vcal->createProperty('X-PROP', '1234256', array('X-PARAM' => '3'));
     $this->assertInstanceOf('Sabre\\VObject\\Property', $prop);
     $event->add($prop);
     $out = $vcal->serialize();
     $this->assertEquals("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nX-PROP;X-PARAM=3:1234256\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", $out);
 }
コード例 #2
0
 function testDestroy()
 {
     $vcal = new Component\VCalendar([], false);
     $event = $vcal->createComponent('VEVENT');
     $this->assertInstanceOf('Sabre\\VObject\\Component\\VEvent', $event);
     $vcal->add($event);
     $prop = $vcal->createProperty('X-PROP', '1234256', ['X-PARAM' => '3']);
     $event->add($prop);
     $this->assertEquals($event, $prop->parent);
     $vcal->destroy();
     $this->assertNull($prop->parent);
 }
コード例 #3
0
 function testIterate()
 {
     $cal = new Component\VCalendar();
     $sub = $cal->createComponent('VEVENT');
     $elems = [$sub, clone $sub, clone $sub];
     $elemList = new ElementList($elems);
     $count = 0;
     foreach ($elemList as $key => $subcomponent) {
         $count++;
         $this->assertInstanceOf('Sabre\\VObject\\Component', $subcomponent);
     }
     $this->assertEquals(3, $count);
     $this->assertEquals(2, $key);
 }