Example #1
0
 /**
  * @covers Jsvrcek\ICS\CalendarExport::getStream 
  */
 public function testGetStream()
 {
     $organizer = new Organizer(new Formatter());
     $organizer->setValue('*****@*****.**')->setName('Sue Jones')->setSentBy('*****@*****.**')->setLanguage('en');
     $attendee = new Attendee(new Formatter());
     $attendee->setName('Jane Smith')->setCalendarUserType('INDIVIDUAL')->setParticipationStatus('ACCEPTED')->setRole('REQ-PARTICIPANT')->setSentBy('joe@example')->addCalendarMember('*****@*****.**')->setValue('*****@*****.**');
     $event = new CalendarEvent();
     $event->setUid('*****@*****.**')->setStart(new \DateTime('1 October 2013'))->setEnd(new \DateTime('31 October 2013'))->setSummary('Oktoberfest at the South Pole')->addAttendee($attendee)->setOrganizer($organizer);
     $rrule = new RecurrenceRule(new Formatter());
     $rrule->setFrequency(new Frequency(Frequency::MONTHLY))->setInterval(2)->setCount(6)->addByDay(new WeekdayNum(Weekday::SATURDAY, 2));
     $event->setRecurrenceRule($rrule);
     $cal = new Calendar();
     $cal->setProdId('-//Jsvrcek//ICS//EN')->setTimezone(new \DateTimeZone('Antarctica/McMurdo'))->addEvent($event);
     $ce = new CalendarExport(new CalendarStream(), new Formatter());
     $ce->addCalendar($cal);
     $stream = $ce->getStream();
     //file_put_contents(__DIR__.'/../../../test.ics', $stream);
     $expected = file_get_contents(__DIR__ . '/../../../test.ics');
     $this->assertEquals($expected, $stream);
 }
Example #2
0
 /**
  * @covers Jsvrcek\ICS\Model\Attendee::__toString()
  */
 public function testToString()
 {
     $this->object->setValue('*****@*****.**')->setName('Joe Smith')->setCalendarUserType('INDIVIDUAL')->addCalendarMember('*****@*****.**')->addDelegatedFrom('*****@*****.**')->addDelegatedTo('*****@*****.**')->addDelegatedTo('*****@*****.**')->setParticipationStatus('ACCEPTED')->setRole('REQ-PARTICIPANT')->setRsvp('TRUE')->setSentBy('*****@*****.**')->setLanguage('en');
     $expected = 'ATTENDEE;CUTYPE=INDIVIDUAL;MEMBER="mailto:list@example.com";ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE;DELEGATED-TO="mailto:sue@example.com","mailto:jane@example.com";DELEGATED-FROM="mailto:mary@example.com";SENT-BY="*****@*****.**";CN=Joe Smith;LANGUAGE=en:mailto:joe-smith@example.com';
     $this->assertEquals($expected, $this->object->__toString());
 }