parent
eca7bd44a5
commit
8ee32bf309
2 changed files with 48 additions and 1 deletions
|
@ -139,7 +139,12 @@ class Event extends BaseEntity
|
||||||
$categories[] = $tag->name;
|
$categories[] = $tag->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = sprintf("https://%s/termine/%s",$_SERVER['HTTP_HOST'],$this->slug);
|
if (array_key_exists('HTTP_HOST',$_SERVER)) {
|
||||||
|
$uid = sprintf("https://%s/termine/%s",$_SERVER['HTTP_HOST'],$this->slug);
|
||||||
|
} else {
|
||||||
|
$uid = sprintf("https://localhost/termine/%s",$this->slug);
|
||||||
|
}
|
||||||
|
|
||||||
$event = [
|
$event = [
|
||||||
'SUMMARY' => $this->summary,
|
'SUMMARY' => $this->summary,
|
||||||
'DTSTART' => $this->startdate,
|
'DTSTART' => $this->startdate,
|
||||||
|
@ -157,6 +162,12 @@ class Event extends BaseEntity
|
||||||
$event["GEO"] = [$this->location->lat, $this->location->lon];
|
$event["GEO"] = [$this->location->lat, $this->location->lon];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!array_key_exists('HTTP_HOST',$_SERVER)) {
|
||||||
|
$dtstamp = new \DateTime();
|
||||||
|
$dtstamp->setDate(2016,06,27);
|
||||||
|
$dtstamp->setTime(0,0,0);
|
||||||
|
$event['DTSTAMP'] = $dtstamp;
|
||||||
|
}
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,4 +100,40 @@ class EventControllerTest extends WebTestCase
|
||||||
$this->assertTrue($form["location_lon"]->getValue() == $entity->location->lon);
|
$this->assertTrue($form["location_lon"]->getValue() == $entity->location->lon);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testICS() {
|
||||||
|
$this->testPostEventForm();
|
||||||
|
|
||||||
|
$client = static::makeClient();
|
||||||
|
|
||||||
|
// events_ics
|
||||||
|
|
||||||
|
$url = $client->getContainer()->get('router')->generate('events_ics');
|
||||||
|
|
||||||
|
$crawler = $client->request('GET', $url);
|
||||||
|
$this->assertStatusCode(200, $client);
|
||||||
|
|
||||||
|
$test_doc = <<<EOF
|
||||||
|
BEGIN:VCALENDAR
|
||||||
|
VERSION:2.0
|
||||||
|
PRODID:-//Sabre//Sabre VObject 4.1.0//EN
|
||||||
|
CALSCALE:GREGORIAN
|
||||||
|
BEGIN:VEVENT
|
||||||
|
UID:https://localhost/termine/testevent
|
||||||
|
DTSTAMP;TZID=Europe/Berlin:20160627T000000
|
||||||
|
SUMMARY:Testevent
|
||||||
|
DTSTART;TZID=Europe/Berlin:20160628T000000
|
||||||
|
DESCRIPTION:Testdescription
|
||||||
|
URL;VALUE=URI:https://calcifer.datenknoten.me
|
||||||
|
CATEGORIES:foo,bar,krautspace
|
||||||
|
DTEND;TZID=Europe/Berlin:20160628T020000
|
||||||
|
LOCATION:Krautspace
|
||||||
|
GEO:1;2
|
||||||
|
END:VEVENT
|
||||||
|
END:VCALENDAR
|
||||||
|
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$this->assertEquals($test_doc, $client->getResponse()->getContent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue