public function testAddTo() { $start = DateTime::create('21.11.1984 13:00'); $iv = DateInterval::create('1 DAY'); $this->assertEquals('22.11.1984 13:00', $iv->addTo($start)->format('d.m.Y H:i')); $this->assertEquals('21.11.1984 13:00', $start->format('d.m.Y H:i')); }
public function ical() { $ical = $this->contentLine('BEGIN', 'VEVENT'); if ($this->allDay) { $ical .= $this->contentLine('DTSTART', $this->icalDate($this->date), array('VALUE' => 'DATE')); $ical .= $this->contentLine('DTEND', $this->icalDate(DateInterval::create('1 DAY')->addTo($this->date)), array('VALUE' => 'DATE')); } $ical .= $this->icalRecurrence($this->recurrence); $ical .= $this->contentLine('DTSTAMP', $this->icalDateTime($this->stamp)); $ical .= $this->contentLine('UID', $this->getUID()); $ical .= $this->contentLine('CREATED', $this->icalDateTime($this->created)); $ical .= $this->contentLine('DESCRIPTION', $this->description); $ical .= $this->contentLine('LAST-MODIFIED', $this->icalDateTime($this->modified)); $ical .= $this->contentLine('LOCATION', $this->location); $ical .= $this->contentLine('SEQUENCE', $this->sequence); $ical .= $this->contentLine('STATUS', $this->status); $ical .= $this->contentLine('SUMMARY', $this->title); $ical .= $this->contentLine('TRANSP', 'TRANSPARENT'); $ical .= $this->contentLine('END', 'VEVENT'); return $ical; }
public function testIcalRecurrence() { $this->assertEquals($this->base->contentLine('RRULE', 'FREQ=YEARLY'), $this->base->icalRecurrence(DateInterval::create('1 YEAR'))); }