-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#4 : support for merging different timezones + test suites
(cherry picked from commit cbffe0b)
- Loading branch information
Showing
6 changed files
with
133 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
DEFAULT_PRODID = "-//FOSSASIA//FOSSASIA Calendar//EN" | ||
DEFAULT_TIME_ZONE => Europe/Berlin | ||
DEFAULT_TIME_ZONE = Europe/Berlin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
require_once(realpath(dirname(__FILE__)) . '/../lib/ics-merger.php'); | ||
|
||
class IcsMergerTest extends PHPUnit_Framework_TestCase { | ||
|
||
private $merger; | ||
|
||
/** | ||
* @before | ||
*/ | ||
public function setupMerger() { | ||
$this->merger = new IcsMerger(); | ||
} | ||
|
||
public function testWithTwoFile() { | ||
$this->merger->add(file_get_contents('../data/freifunk_0')); | ||
$this->merger->add(file_get_contents('../data/freifunk_3')); | ||
$result = $this->merger->getResult(); | ||
$this->assertEquals(count($result['VEVENTS']), 3); | ||
/* | ||
echo '<pre>'; | ||
var_dump($result); | ||
echo '</pre>'; | ||
echo IcsMerger::getRawText($result); | ||
*/ | ||
} | ||
|
||
public function testConversionLocalTimeWithTimezone() { | ||
$this->merger->add | ||
("BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTSTART;TZID=Asia/Saigon:20150527T213000 | ||
SUMMARY:Event 1 | ||
END:VEVENT | ||
END:VCALENDAR | ||
"); | ||
$this->merger->add | ||
("BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTSTART;TZID=EST:20150527T213000 | ||
SUMMARY:Event 2 | ||
END:VEVENT | ||
END:VCALENDAR | ||
"); | ||
$this->assertEquals($this->merger->getResult()['VEVENTS']['0']['DTSTART']['value'], '20150527T163000'); | ||
$this->assertEquals($this->merger->getResult()['VEVENTS']['1']['DTSTART']['value'], '20150528T033000'); | ||
} | ||
|
||
public function testConversionLocalTimeWithoutTimezone() { | ||
$this->merger->add | ||
("BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTSTART:20150527T213000 | ||
SUMMARY:Event 1 | ||
END:VEVENT | ||
END:VCALENDAR | ||
"); | ||
$this->merger->add | ||
("BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTSTART;TZID=EST:20150527T213000 | ||
SUMMARY:Event 2 | ||
END:VEVENT | ||
END:VCALENDAR | ||
"); | ||
$this->assertEquals($this->merger->getResult()['VEVENTS']['0']['DTSTART']['value'], '20150527T163000'); | ||
$this->assertEquals($this->merger->getResult()['VEVENTS']['1']['DTSTART']['value'], '20150528T023000'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.