예제 #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);
 }
예제 #2
0
파일: OrganizerTest.php 프로젝트: enko/ics
 /**
  * @covers Jsvrcek\ICS\Model\Organizer::__toString()
  */
 public function testToString()
 {
     $this->object->setValue('*****@*****.**')->setName('Leonardo Da Vinci')->setLanguage('it')->setDirectory('http://en.wikipedia.org/wiki/Leonardo_da_Vinci')->setSentBy('*****@*****.**');
     $expected = 'ORGANIZER;SENT-BY="*****@*****.**";CN=Leonardo Da Vinci;DIR="http://en.wikipedia.org/wiki/Leonardo_da_Vinci";LANGUAGE=it:mailto:leonardo@example.it';
     $this->assertEquals($expected, $this->object->__toString());
 }